Write a program to print prime nums from 1-20 using c
programing?
Answers were Sorted based on User's Feedback
#include<stdio.h>
#include<conio.h>
int main()
{
int i,n;
for(n=2;n<=20;n++)
{
for(i=2;i<n;i++)
{if(n%i==0)
break;}
}
if(i==n)
printf("\n %d",n);
return 0;
}
| Is This Answer Correct ? | 2 Yes | 5 No |
Answer / musa
#include <stdio.h>
main(){
printf("2 5 7 11 13 17 19");
}
| Is This Answer Correct ? | 10 Yes | 14 No |
/* hello i am ricky dobriyal software enginear*/
#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();
}
output:-1 2 3 4 7 11 13 17 19
| Is This Answer Correct ? | 18 Yes | 27 No |
what is the output of below pgm? void main() { int i=0; if(i) printf("pass"); else printf("fail"); }
What is the total generic pointer type?
main() { int x=5; printf("%d %d %d\n",x,x<<2,x>>2); } what is the output?
Do you know what are the properties of union in c?
Define Array of pointers.
Why is not a pointer null after calling free?
How can I find out the size of a file, prior to reading it in?
WAP – represent a char in binary format
write a reverse string to print a stars.(with out using logic) ***** **** *** ** *
Explain what could possibly be the problem if a valid function name such as tolower() is being reported by the c compiler as undefined?
WAP to accept rollno,course name & marks of a student & display grade if total marks is above 200?
question-how to run a c programme.