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
Why is a semicolon (;) put at the end of every program statement?
What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?
Is int a keyword in c?
what type of questions arrive in interview over c programming?
Do variables need to be initialized?
What is call by reference in functions?
What are the functions to open and close file in c language?
How are strings stored in c?
Is that possible to add pointers to each other?
What is the use of sizeof () in c?
How many keywords are there in c?
How many types of sorting are there in c?
How to write a code for implementing my own printf() and
scanf().... Please hep me in this... I need a guidance...
Can you give an coding for c... Please also explain about
the header files used other than #include
What is the difference between malloc() and calloc() function in c language?
Differentiate between the = symbol and == symbol?