write the program for prime numbers?
Answer Posted / dinesh kumar.s
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,a;
clrscr();
printf("program created by dinesh mca anna university\n");
printf("enter the number\n");
scanf("%d",&a);
j=a;
if( a%2==0 || a%3==0 )
{
for(i=2;i<=a;i++)
if(a%i==0)
if (i==j)
{
printf("prime number");
break;
}
else
{
printf("not");
break;
}
}
else
{
printf("prime number");
}
getch();
}
| Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
Add Two Numbers Without Using the Addition Operator
What is array in c with example?
How can I send mail from within a c program?
What is a #include preprocessor?
How can you tell whether a program was compiled using c versus c++?
using only #include
What is the time and space complexities of merge sort and when is it preferred over quick sort?
What is floating point constants?
define string ?
please give me some tips for the placement in the TCS.
How to get string length of given string in c?
Define circular linked list.
What are the different types of objects used in c?
When should a type cast be used?
How are portions of a program disabled in demo versions?