write the program for prime numbers?
Answer Posted / paartha
include<stdio.h>
#include<conio.h>
void main()
{
int a,i , b,flag=0,no;
clrscr();
for(no=2;no<100;no++)
{
for(i=2;i<no;i++)
{
b=no%i;
if(b==0)
{
flag=1;
break;
}
else
{
flag=0;
}
}
if(flag!=1)
{
printf("\n%d",no);
}
}
getch();
}
| Is This Answer Correct ? | 7 Yes | 3 No |
Post New Answer View All Answers
What is a built-in function in C?
What are the types of assignment statements?
Is printf a keyword?
Can include files be nested?
define string ?
Some coders debug their programs by placing comment symbols on some codes instead of deleting it. How does this aid in debugging?
Write a function stroverlap that takes (at least) two strings, and concatenates them, but does not duplicate any overlap. You only need to worry about overlaps between the end of the first string and the beginning of the second string. Examples: batman, manonthemoon = batmanonthemoon batmmamaman, mamamanonthemoon = batmmamamanonthemoon bat, man = batman batman, batman = batman batman, menonthemoon = batmanmenonthemoon
#include
What is the modulus operator?
What is the purpose of the preprocessor directive error?
What is the need of structure in c?
What is the best organizational structure?
7-Given an index k, return the kth row of the Pascal's triangle. For example, when k = 3, the row is [1,3,3,1]. For reference look at the following standard pascal’s triangle.
Explain what does the format %10.2 mean when included in a printf statement?
What is the difference between far and near ?