write the program for prime numbers?
Answer Posted / akhilesh singh(m.c.a-iisem ois
main()
{
int i,j=2,ch=0;
clrscr();
printf("\nENTER ANY NUMBER");
scanf("%d",&i);
while(j<=i/2)
{
if(i%j==0)
{
printf("%d IS NOT PRIME",i);
ch=1;
break;
}
else
{
j++;
}
}
if(ch==0)
{
printf("%d IS PRIME",i);
}
}
| Is This Answer Correct ? | 1243 Yes | 384 No |
Post New Answer View All Answers
write an interactive C program that will encode or decode a line of text.To encode a line of text,proceed as follows. 1.convert each character,including blank spaces,to its ASCII equivalent. 2.Generate a positive random integer.add this integer to the ASCII equivalent of each character.The same random integer will be used for the entire line of text. 3.Suppose that N1 represents the lowest permissible value in the ASCII code,and N2 represents the highest permissible value.If the number obtained in step 2 above(i.e.,the original ASCII equivalent plus the random integer)exceeds N2,then subtract the largest possible multiple of N2 from this number,and add the remainder to N1.Hence the encoded number will always fall between N1 and N2,and will therefore always represent some ASCII character. 4.Dislay the characters that correspond to the encoded ASCII values. The procedure is reversed when decoding a line of text.Be certain,however,that the same random number is used in decodingas was used in encoding.
What is modifier & how many types of modifiers available in c?
which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above
Hai,I have done with my bachelor of commerce and planing to ms,please suggest me how to convince vo for shifting from commerce to computers. Visa on 8 DEC 2014 Npu university
What's the right way to use errno?
How can I open files mentioned on the command line, and parse option flags?
Can the curly brackets { } be used to enclose a single line of code?
how many errors in c explain deply
What is an expression?
Please send me WIPRO technical question to my mail ID.. its nisha_g28@yahoo.com please its urgent
A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference
What is c programing language?
How does pointer work in c?
What is the total generic pointer type?
How do I read the arrow keys? What about function keys?