write the program for prime numbers?
Answer Posted / venkat reddy
#include<stdio.h>
main()
{
int i,n,count=0;
printf("enter a no.");
scanf("%d",&n);
for(i=2;i<n;i++)
{
if(n%i==0)
{
count++;
}
}
if(count>1)
{
printf("not prime no.");
}
else
printf("prime");
}
Is This Answer Correct ? | 344 Yes | 155 No |
Post New Answer View All Answers
What is the use of ?
Is there any demerits of using pointer?
What is sizeof int in c?
What is void main () in c?
What are derived data types in c?
main(){char *str;scanf("%s",str);printf("%s",str); }The error in the above program is: a) Variable 'str' is not initialised b) Format control for a string is not %s c) Parameter to scanf is passed by value. It should be an address d) none
What is the need of structure in c?
Difference between MAC vs. IP Addressing
void main(int n) { if(n==0) return; main(--n); printf("%d ",n); getch(); } how it work and what will be its output...............it any one know ans plz reply
Explain about the constants which help in debugging?
Why structure is used in c?
With the help of using classes, write a program to add two numbers.
Are there constructors in c?
What is use of null pointer in c?
Is c programming hard?