write the program for prime numbers?

Answer Posted / pritam neogi

#include<stdio.h>
#include<conio.h>
void main()
{
int no,i,count=0;
clrscr();
printf("enter the no");
scanf("%d",&no);
for(i=1;i<=no;i++)
{
if(no%i==0)
{
count=count+1;
}
}
if(count<=2)
{
printf("this is prime no");
}
else
{
printf("this is not prime");
}
getch();
}

Is This Answer Correct ?    32 Yes 16 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

In c programming write a program that will print 10 multiples of 3 except 15,18,21 using looping

974


What is a struct c#?

599


to find the closest pair

1816


How to create struct variables?

588


Explain what is a pragma?

587






Compare interpreters and compilers.

635


Can you please explain the difference between exit() and _exit() function?

585


Difference between Function to pointer and pointer to function

625


Which header file is essential for using strcmp function?

932


Who is the main contributor in designing the c language after dennis ritchie?

543


how many types of operators are include in c language a) 4 b) 6 c) 8 d) 12

646


how many errors in c explain deply

1625


the statement while(i) puts the entire logic in loop. this loop is called a) indefinite loop b) definite loop c) loop syntax wrong d) none of the above

602


What is optimization in c?

562


How many levels of pointers can you have?

695