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 I ++ in c programming?
What is derived datatype in c?
What is the purpose of the preprocessor directive error?
Why doesnt long int work?
What does int main () mean?
When is a null pointer used?
How can I get random integers in a certain range?
which of the following shows the correct hierarchy of arithmetic operations in C a) (), **, * or/,+ or - b) (),**,*,/,+,- c) (),**,/,*,+,- d) (),/ or *,- or +
What is the difference between volatile and const volatile?
What is the Purpose of 'extern' keyword in a function declaration?
Explain how do you search data in a data file using random access method?
Explain what is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?
Is boolean a datatype in c?
Explain a file operation in C with an example.
How many types of arrays are there in c?