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

Why is sizeof () an operator and not a function?

569


Can an array be an Ivalue?

657


What is the difference between the local variable and global variable in c?

524


Explain output of printf("Hello World"-'A'+'B'); ?

967


Are negative numbers true in c?

590






How are Structure passing and returning implemented by the complier?

705


What is c token?

599


Is array a primitive data type in c?

571


What is %g in c?

608


using only #include and #include Write a program in C that will read an input from the user and print it back to the user if it is a palindrome. The string ends when it encounters a whitespace. The input string is at most 30 characters. Assume the string has no spaces and distinguish between and lowercase. So madam is a palindrome, but MadAm is not a palindrome. Use scanf and %s to read the string. Sample Test: Enter a string: madam madam is a palindrome. Enter a string: 09023 09023 is not a palindrome.

1302


Is fortran still used today?

595


plz let me know how to become a telecom protocol tester. thank you.

1736


What is c mainly used for?

591


Can two or more operators such as and be combined in a single line of program code?

799


Why do we need a structure?

580