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
i want to know the procedure of qualcomm for getting a job through offcampus
Calculate 1*2*3*____*n using recursive function??
Explain what is the advantage of a random access file?
Who developed c language?
What is character set?
What is the translation phases used in c language?
What is spark map function?
Why are some ANSI/ISO Standard library routines showing up as undefined, even though I've got an ANSI compiler?
Once I have used freopen, how can I get the original stdout (or stdin) back?
How do I create a directory? How do I remove a directory (and its contents)?
formula to convert 2500mmh2o into m3/hr
write a program to print largest number of each row of a 2D array
A banker has a seif with a cipher. Not to forget the cipher, he wants to write it coded as following: each digit to be replaced with the difference of 9 with the current digit. The banker chose a cipher. Decipher it knowing the cipher starts with a digit different than 9. I need to write a program that takes the cipher from the keyboard and prints the new cipher. I thought of the following: Take the input from the keyboard and put it into a string or an array. Go through the object with a for and for each digit other than the first, substract it from 9 and add it to another variable. Print the new variable. Theoretically I thought of it but I don't know much C. Could you give me any kind of hint, whether I am on the right track or not?
What does 3 mean in texting?
In which language linux is written?