Write a program to print prime nums from 1-20 using c
programing?
Answer Posted / ruth
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,s;
printf("prime number 1 to 20 :\n");
for(i=1;i<=20;i++)
{
s=0;
for(j=2;j<i;j++)
{
if(i==1)
s=0;
else if(i%j==0)
s=1;
}
if(s==0)
printf("%d\t",i);
}
getch();
}
| Is This Answer Correct ? | 18 Yes | 3 No |
Post New Answer View All Answers
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
Explain what’s a signal? Explain what do I use signals for?
What are 3 types of structures?
pierrot's divisor program using c or c++ code
What are the different properties of variable number of arguments?
Is c is a low level language?
What kind of structure is a house?
Why is c not oop?
Write a code to generate a series where the next element is the sum of last k terms.
Given an array of 1s and 0s arrange the 1s together and 0s together in a single scan of the array. Optimize the boundary conditions?
What is the difference between Printf(..) and sprint(...) ?
Are enumerations really portable?
Explain what math functions are available for integers? For floating point?
What is pointers in c?
Write a code to achieve inter processor communication (mutual exclusion implementation pseudo code)?