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 oops means?
What is sizeof array?
What is openmp in c?
Can we access the array using a pointer in c language?
Compare array data type to pointer data type
Explain 'bus error'?
we need to calculating INCOME TAX for the person. The INCOME TAX is as follows:- First $10000/- of income : 4% tax Next $10000/- of income : 8% tax Next $10000/- of income : 11.5% tax above $10, 00,00/- : 15% tax What is the Solution of this Question ?
Write a program to implement queue.
What is the right type to use for boolean values in c?
What is #define in c?
Explain what is the benefit of using #define to declare a constant?
What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?
What is the use of pointers in C?
Write a code of a general series where the next element is the sum of last k terms.
What is static volatile in c?