Source Code :
#include<stdio.h>
void main()
{
int n=10,i,j,fl=0; //Declaration of variables
clrscr();
printf("\nThe Prime Numbers between 10 to 50 :")
for(i=n;i<=50;i++) //For Loop Iteration from 10 to 50 times
{
fl=0;
for(j=2;j<i;j++) //For Loop for checking prime number
{
if(i%j==0) //Checking if the number can be divided
{ //by any other number other
fl=1;
}
}
if(fl==0) //Checking for result
printf("%d ",i); //Display the number
}
printf(“\nPress any Key to Continue………”);
getch();
}
Output :
The Prime Numbers between 10 to 50 : 11 13 17 19 23 29 31 37 41 43 47
hi, its good program. I dint see the others program which does not maintain the indentation it look odd to look at such program without indentation.
ReplyDelete