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
Describe dynamic data structure in c programming language?
Is null always equal to 0(zero)?
Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......
How can I write functions that take a variable number of arguments?
What is the time and space complexities of merge sort and when is it preferred over quick sort?
What does sizeof int return?
Why doesnt the call scanf work?
Why we write conio h in c?
Explain what is wrong with this program statement?
What is meant by inheritance?
What is the use of define in c?
Explain setjmp()?
what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;
What is the description for syntax errors?
Why c is known as a mother language?