Write a program to print the prime numbers from 1 to 100?
Answer Posted / prth
#include<stdio.h>
#include<conio.h>
void main()
{
int flag,x;
clrscr();
printf("1\t");
for(int i=1;i<=100;i++)
{
flag=0;
for(x=2;x<=i;x++)
{
if(i%x==0)
{
flag=1;
break;
}
else
continue;
}
if(i==x)
printf("%d\t",i);
}
getch();
}
| Is This Answer Correct ? | 48 Yes | 11 No |
Post New Answer View All Answers
Program to find the sum of digits of a given number until the sum becomes a single digit. (e.g. 12345=>1+2+3+4+5=15=>1+5=6)
Are there any problems with performing mathematical operations on different variable types?
Write a program to print “hello world” without using semicolon?
c program to compute AREA under integral
printf(), scanf() these are a) library functions b) userdefined functions c) system functions d) they are not functions
Why array is used in c?
which is an algorithm for sorting in a growing Lexicographic order
Is c dynamically typed?
In C language, the variables NAME, name, and Name are all the same. TRUE or FALSE?
explain what are pointers?
What are the different types of objects used in c?
number of times a digit is present in a number
What is the difference between near, far and huge pointers?
What are the functions to open and close the file in c language?
write a program in c language to print your bio-data on the screen by using functions.