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 static function in c?
Explain what is wrong in this statement?
What should malloc(0) do?
How can I run c program?
How many types of errors are there in c language? Explain
What are the key features in c programming language?
What is the difference between null pointer and wild pointer?
How can I open files mentioned on the command line, and parse option flags?
PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE
Is anything faster than c?
What is Dynamic memory allocation in C? Name the dynamic allocation functions.
Write program to remove duplicate in an array?
why wipro wase
What is a static function in c?
How can I automatically locate a programs configuration files in the same directory as the executable?