What's New-Given Below
technicalsymposium
technicalsymposium
technicalsymposium

C/C++ Lab Program(s)/Materials

C Program for Prime Number Generation.

#include<stdio.h>
#include<conio.h>
void main()
{
int n,j,a=0,i;
clrscr();
printf(" Please Enter a number :");
scanf("%d",&n);
printf("\n\n");
printf("OUTPUT:\n");
printf("------");
printf("\n\n");
printf("The Prime Number series is\n");
printf("**************************");
for(j=1;j<=n;j++)
{
for(i=2;i<j;i++)
{
if(j%i==0)
{
a=1;
goto x;
}
}
if((a==0)&&(j!=1))
{
printf("\n%d",j);
}
x:
a=0;
}
getch();
}

More Lab Programs with Answers -Given Below-Click and Get Freely

Hosting by Yahoo!

About-Us    Contact-Us    Site-map

©copyright 2009 All rights are reserved to technicalsymposium.com