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
Why do we use int main?
What does *p++ do? What does it point to?
What do header files do?
Explain the ternary tree?
What is the size of structure in c?
Write a C program that will accept a hexadecimal number as input and then display a menu that will permit any of the following operations to be carried out: Display the hexadecimal equivalent of the one's complement. (b) Carry out a masking operation and then display the hexadecimal equivalent of the result. (c) Carry out a bit shifting operation and then display the hexadecimal equivalent of the result. (d) Exit. If the masking operation is selected, prompt the user lor the type of operation (bitwise and, bitwise exclusive or, or bitwise or) and then a (hexadecimal) value for the mask. If the bit shifting operation is selected. prompt the user for the type of shift (left or right), and then the number of bits. Test the program with several different (hexadecimal) input values of your own choice.
What is difference between constant pointer and constant variable?
What is the value of c?
List some of the static data structures in C?
What does c mean?
Explain 'bus error'?
Is null always equal to 0(zero)?
What does 4d mean in c?
Explain how do I determine whether a character is numeric, alphabetic, and so on?
What is void pointers in c?