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
how is the examination pattern?
Describe the complexity of Binary search, Quicksort and various other sorting and searching techniques..
c program to compute AREA under integral
Write a program to print fibonacci series without using recursion?
Why should I prototype a function?
What is the correct code to have following output in c using nested for loop?
Explain the term printf() and scanf() used in c language?
Explain how do you use a pointer to a function?
How can I rethow can I return a sequence of random numbers which dont repeat at all?
Write a program to print factorial of given number without using recursion?
How pointers are declared?
What is null pointer in c?
Define macros.
What are different storage class specifiers in c?
write a c program in such a way that if we enter the today date the output should be next day's date.