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 does c in a circle mean?
What does sizeof int return?
What are the keywords in c?
what are the program that using a two dimensional array that list the odd numbers and even numbers separately in a given 10 inputs values
how to build a exercise findig min number of e heap with list imlemented?
How can I display a percentage-done indication that updates itself in place, or show one of those twirling baton progress indicators?
Why static variable is used in c?
What tq means in chat?
why we wont use '&' sing in aceesing the string using scanf
Explain argument and its types.
the process of defining something in terms of itself is called (or) in C it is possible for the functions to call themselves. A function called a) nested function b) void function c) recursive function d) indifinite function
What kind of structure is a house?
What does a derived class inherit from a base class a) Only the Public members of the base class b) Only the Protected members of the base class c) Both the Public and the Protected members of the base class d) .c file
write a c program for swapping two strings using pointer
How to write c functions that modify head pointer of a linked list?