Write a program to print prime nums from 1-20 using c
programing?

Answer Posted / r@m$

#include<stdio.h>
void main(){
int x;
for(x=2;x<=20;x++){
if(x<4)
printf("%d\t",x);
else
if(x%2!=0 && x%3!=0)
printf("%d\t",x);
}
}

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a program to use switch statement.

668


What do you mean by Recursion Function?

636


What is calloc in c?

671


a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above

887


What is a const pointer?

644






main(){char *str;scanf("%s",str);printf("%s",str); }The error in the above program is: a) Variable 'str' is not initialised b) Format control for a string is not %s c) Parameter to scanf is passed by value. It should be an address d) none

737


What is the general form of a C program?

608


What does 4d mean in c?

959


What is a structure member in c?

559


What is union and structure in c?

628


What is the purpose of main() function?

667


which is an algorithm for sorting in a growing Lexicographic order

1405


GIven a sequence of characters. How will you convert the lower case characters to upper case characters. ( Try using bit vector - sol given in the C lib -> typec.h)

692


What is array of pointers to string?

578


Write a program of prime number using recursion.

627