write the program for prime numbers?
Answer Posted / oza priyanka
#include<stdio.h>
void main()
{
int num,i,cnt;
clrscr();
printf("\n\nEnter the number = ");
scanf("%d",&num);
for(i=2,cnt=0;i<num;i++)
{
if(num%i==0)
cnt=1;
}
if(cnt==0)
printf("\n\nprime number");
else
printf("\n\n not a prime number");
getch();
}
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
provide an example of the Group by clause, when would you use this clause
Is it fine to write void main () or main () in c?
What is c programing language?
about c language
Explain how can I convert a string to a number?
How can I run c program?
Explain what are run-time errors?
What is meant by recursion?
What is %d called in c?
What are two dimensional arrays alternatively called as?
Differentiate fundamental data types and derived data types in C.
Do you know the purpose of 'register' keyword?
What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?
What are 3 types of structures?
Is null always defined as 0(zero)?