write a Program to dispaly upto 100 prime numbers(without
using Arrays,Pointer)
Answer Posted / paras patel
#include <stdio.h>
#include <conio.h>
int divide(int x ,int y)
{
while(x>y)
{
x-=y;
}
if(x==y)
{
x=0;
}
return x;
}
void main()
{
int c,i,n;
scanf("%d",&n);
clrscr();
for( i=2;i<=n;i++)
{
if(divide(n,i)==0)
{
break;
}
}
if(i!=n)
{
printf("not prime");
}
else
{
printf("prime");
}
getch();
}
| Is This Answer Correct ? | 16 Yes | 17 No |
Post New Answer View All Answers
What is clrscr in c?
What does void main return?
Explain the difference between call by value and call by reference in c language?
Can you please compare array with pointer?
what is the c source code for the below output? 5555555555 4444 4444 333 333 22 22 1 1 22 22 333 333 4444 4444 5555555555
Is flag a keyword in c?
Is multithreading possible in c?
What is break in c?
How pointers are declared?
what is a NULL Pointer? Whether it is same as an uninitialized pointer?
which of the following statement is wrong a) mes=123.56; b) con='T'*'A'; c) this='T'*20; d) 3+a=b;
What is a stream water?
Why is c so popular?
Why does the call char scanf work?
What does %c mean in c?