write the program for prime numbers?
Answer Posted / sikendar kumar
#include<stdio.h>
#include<conio.h>
main()
{
int i,n,count=0;
clrscr();
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");
return 0;
}
Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
Is there any possibility to create customized header file with c programming language?
How do you search data in a data file using random access method?
What is the use of function overloading in C?
How can variables be characterized?
How many levels of pointers can you have?
Describe the order of precedence with regards to operators in C.
a character or group of characters that defines a register,or a part of storage a) memory b) byte c) address d) linear list
What is double pointer?
List some applications of c programming language?
Explain how can I prevent another program from modifying part of a file that I am modifying?
How arrays can be passed to a user defined function
Why is %d used in c?
Explain what are preprocessor directives?
if (i = 0)printf ("True"); elseprintf("False"); Under what conditions will the above print out the string "True" a) Never b) Always c) When the value of i is 0 d) all of the above
#include