write the program for prime numbers?
Answer Posted / arafat buet
#include<stdio.h>
int main()
{
int i,n,r;
printf("enter any number:");
scanf("%d",&n);
if(n==1)
printf("not prime\n");
for(i=2;i<n;i++)
{
r=n%2;
if(r==0)
{
printf("\nnot prime\n");
break;
}
}
if(i==n)
printf("prime\n");
return 0;
}
| Is This Answer Correct ? | 24 Yes | 19 No |
Post New Answer View All Answers
Write a program on swapping (100, 50)
How is pointer initialized in c?
What is #include stdio h and #include conio h?
Which built-in library function can be used to match a patter from the string?
What functions are used in dynamic memory allocation in c?
What are the primitive data types in c?
What is the difference between functions getch() and getche()?
Is calloc better than malloc?
Write a program to generate a pulse width frequency of your choise,which can be variable by using the digital port of your processor
What is scope rule of function in c?
Where define directive used?
what is the role you expect in software industry?
how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?
Is fortran faster than c?
What is extern keyword in c?