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 is #ifdef ? What is its application?
What is a structure in c language. how to initialise a structure in c?
What is a dynamic array in c?
Why is this loop always executing once?
How can I call fortran?
Differentiate between Macro and ordinary definition.
What is integer constants?
Write a program on swapping (100, 50)
How was c created?
Can we use any name in place of argv and argc as command line arguments?
Is a house a shell structure?
What oops means?
What are types of structure?
What is n in c?
What is pass by reference in c?