Write a program to print prime nums from 1-20 using c
programing?
Answer Posted / bheem rao
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,count=0;
for(i=2;i<=20;i++)
{
for(j=1;j<=i;i++)
{
if(i%j==0)
count++;
}
if(count==2)
printf("%d\n",i);
count=0;
}
}
| Is This Answer Correct ? | 12 Yes | 8 No |
Post New Answer View All Answers
What are the types of pointers in c?
How does free() know explain how much memory to release?
Is swift based on c?
Explain what would happen to x in this expression: x += 15; (assuming the value of x is 5)
Badboy is defined who has ALL the following properties: Does not have a girlfriend and is not married. He is not more than 23 years old. The middle name should be "Singh" The last name should have more than 4 characters. The character 'a' should appear in the last name at least two times. The name of one of his brothers should be "Ram" Write a method: boolean isBadBoy(boolean hasGirlFriend , boolean isMarried, int age , String middleName , String lastName , String[] brotherName); isHaveGirlFriend is true if the person has a girlfriend isMarried is true if the person is married age is the age of the person middleName is the middle name of the person lastName is the last name of the person brotherName is the array of the names of his brothers
What is the easiest sorting method to use?
Can you please explain the difference between exit() and _exit() function?
What are the types of bitwise operator?
Can variables be declared anywhere in c?
Can you please compare array with pointer?
What is the advantage of a random access file?
how to print the character with maximum occurence and print that number of occurence too in a string given ?
Can you write a programmer for FACTORIAL using recursion?
How can you determine the size of an allocated portion of memory?
Write a program to print numbers from 1 to 100 without using loop in c?