write a Program to dispaly upto 100 prime numbers(without
using Arrays,Pointer)
Answer Posted / anshul
#include <stdio.h>
#include<conio.h>
void main()
{
int i,j,k;
for (i=1;i<=100;i++)
{
k=0;
for (j=1;j<i;j++)
{
if (i%j==0)
{
k++;
}
}
if(k==2)
{
printf("%d \n",i);
}
}
getch();
}
It displays all prime no. from 1 to 100
commants: er.anshul2009@gmail.com
| Is This Answer Correct ? | 4 Yes | 7 No |
Post New Answer View All Answers
Differentiate between the expression “++a” and “a++”?
What is meant by recursion?
Given below are three different ways to print the character for ASCII code 88. Which is the correct way1) char c = 88; cout << c << " ";2) cout.put(88);3) cout << char(88) << " "; a) 1 b) 2 c) 3 d) constant
Is c language still used?
What is meant by 'bit masking'?
What is void main ()?
Can an array be an Ivalue?
Why c language?
Place the #include statement must be written in the program?
What are multibyte characters?
Why is c known as a mother language?
How many header files are in c?
A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference
what are # pragma staments?
What are the advantages of Macro over function?