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
What is the difference between functions abs() and fabs()?
Is there a way to switch on strings?
What is extern storage class in c?
int i[2], j; int *pi;i[0] = 1; i[1] = 5; pi = i; j = *pi + 1 + *(pi + 1)Value of j after execution of the above statements will be a) 7 b) 6 c) 4 d) pointer
What are the types of i/o functions?
why do some people write if(0 == x) instead of if(x == 0)?
What is a program?
Explain how can I write functions that take a variable number of arguments?
What is the size of array float a(10)?
What is call by value in c?
What is the c value paradox and how is it explained?
Why is c so powerful?
Explain what is the general form of a c program?
cavium networks written test pattern ..
What is type qualifiers?