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
Write a program to generate the Fibinocci Series
What are void pointers in c?
What is a example of a variable?
What is volatile variable in c with example?
Can the sizeof operator be used to tell the size of an array passed to a function?
How do I convert a string to all upper or lower case?
When should a type cast be used?
Explain what is the benefit of using an enum rather than a #define constant?
In a byte, what is the maximum decimal number that you can accommodate?
Are the variables argc and argv are always local to main?
What are the types of arrays in c?
What is the use of ?: Operator?
Explain what are run-time errors?
Where static variables are stored in memory in c?
Explain modulus operator.