728x90 AdSpace

Latest Article

C C++ Program Code Number is Prime or composite number




C C++ Program Code Number is Prime or  composite number Code Online Programming Source code



#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int i,num,k;
char prime;

printf("enter a number greater than 0\n");
scanf("%d",&num);
for(i=1;i<=num;i++)  {
   prime='y';
     for(k=1;k<=sqrt(i);k++){
if(i%k==0){
   prime='n';
     break;
}
 }
  if(prime='n')
     printf(" is composite number\n,i");
  else
     printf(" is prime number\n,i");
   getche();
}
}
no image
  • Title : C C++ Program Code Number is Prime or composite number
  • Posted by :
  • Date : 04:06
  • Labels :





  • Blogger Comments
  • Facebook Comments

0 comments:

Post a Comment

Top