write a Program to dispaly upto 100 prime numbers(without
using Arrays,Pointer)
Answer Posted / vignesh1988i
#include<stdio.h>
#include<conio.h>
void main()
{
int m,flag;
printf("enter the numbers upto which you wannt to find the prime numbers :");
scanf("%d",&m);
for(int i=1;i<=m;i++)
{
flag=1;
for(int j=2;j<=i/2;j++)
{
if(i%j==0)
flag=0;
}
if(flag==1)
printf("\n%d",i);
}
getch();
}
thank u
| Is This Answer Correct ? | 49 Yes | 24 No |
Post New Answer View All Answers
What does it mean when a pointer is used in an if statement?
Explain with the aid of an example why arrays of structures don’t provide an efficient representation when it comes to adding and deleting records internal to the array.
explain what is an endless loop?
What is the difference between functions abs() and fabs()?
Can you write the algorithm for Queue?
the real constant in c can be expressed in which of the following forms a) fractional form only b) exponential form only c) ascii form only d) both a and b
What are the advantages of Macro over function?
What is a newline escape sequence?
Write a program to check prime number in c programming?
what value is returned to operating system after program execution?
I need testPalindrome and removeSpace
#include
what is the significance of static storage class specifier?
What is main () in c language?
Are bit fields portable?
What is #include cctype?