write the program for prime numbers?
Answer Posted / ashwini kumar nayak
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int c,i,n;
c=0;
printf("Enter the number");
scanf("%d",&n);
if(n==1)
printf("Number is the special number");
else
{
for(i=2;i<n;i++)
if (n%i==0)
{
c=1;break;
}
if(c!=1)
printf("prime");
else
printf ("not a prime");
}
getch();
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is a function in c?
write a c program to print the next of a particular no without using the arithmetic operator or looping statements?
What is the collection of communication lines and routers called?
How can I sort more data than will fit in memory?
Why isn't it being handled properly?
What is the use of sizeof?
What is atoi and atof in c?
What are local static variables?
Write a program to implement queue.
What is the significance of an algorithm to C programming?
What is const volatile variable in c?
What is line in c preprocessor?
a formula,a series of steps,or well defined set of rules for solving a problem a) algorithem b) program c) erdiagram d) compiler
Explain about the functions strcat() and strcmp()?
What is Dynamic memory allocation in C? Name the dynamic allocation functions.