Write a program to print prime nums from 1-20 using c
programing?
Answer Posted / dinesh
#include<stdio.h>
main()
{
int i,j;
for(i=2;i<=20;i++)
{
c=1;
for(j=2;j<i;j++)
{
if(i%j==0)
c=0;
}
if(c==1)
printf("%d",i);
}
}
| Is This Answer Correct ? | 46 Yes | 21 No |
Post New Answer View All Answers
How do you determine a file’s attributes?
Explain what is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?
When is a null pointer used?
an expression contains relational operators, assignment operators, and arithmatic operstors. In the absence of parentheses, they will be evaluated in which of the following order a) assignment, relational, arithematic b) arithematic, relational, assignment c) relational, arithematic, assignment d) assignment, arithematic, relational
What is a stream?
Why is c platform dependent?
What is the use of getchar() function?
how to execute a program using if else condition and the output should enter number and the number is odd only...
What are the advantages of the functions?
An arrangement of information in memory in such a way that it can be easily accessed and processed by a programming language a) string b) data structure c) pointers d) array
What is the scope of global variable in c?
When would you use a pointer to a function?
Which one to choose from 'initialization lists' or 'assignment', for the use in the constructor?
Explain how do you print an address?
List the variables are used for writing doubly linked list program.