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 c program in such a way that if we enter the today date the output should be next day's date.

1906


What is assert and when would I use it?

774


What is maximum size of array in c?

775


What is meant by int main ()?

948


Write a program to swap two numbers without using third variable?

1046


What is the purpose of 'register' keyword in c language?

816


The purpose of this exercise is to benchmark file writing and reading speed. This exercise is divided into two parts. a). Write a file character by character such that the total file size becomes approximately >10K. After writing close the file handler, open a new stream and read the file character by character. Record both times. Execute this exercise at least 4 times b). Create a buffer capable of storing 100 characters. Now after generating the characters, first store them in the buffer. Once the buffer is filled up, store all the elements in the file. Repeat the process until the total file size becomes approximately >10K.While reading read a while line, store it in buffer and once buffer gets filled up, display the whole buffer. Repeat the exercise at least 4 times with different size of buffer (50, 100, 150 …). Records the times. c). Do an analysis of the differences in times and submit it in class.

1835


What are global variables?

866


What is a function in c?

1188


Function which gives a pointer to a binary trees const an integer value at each code, return function of all the nodes in binary tree.?

822


Define recursion in c.

946


Can the sizeof operator be used to tell the size of an array passed to a function?

840


What is a char c?

803


What does the file stdio.h contain?

805


Explain how can I convert a string to a number?

842