write the program for prime numbers?
Answer Posted / paul
#include <stdio.h>
#include<stdlib.h>
#define TRUE 1
#define FALSE 0
int main()
{
int i,x,prime = TRUE;
printf(".:Modified Prime Program:.\n\n");
printf("Enter a number: ");
scanf("%d",&x);
printf("\nNUMBER\t REMARKS\n");
do
{
for(i=2;i<x;i++)
if(x%i==0)
{
prime=FALSE;
break;
}
if (prime=1 && (!(i<=x/2)))
printf("%d\t PRIME\n",x);
else
printf("%d\t COMPOSITE\n",x);
}
while (x-=1);
system ("pause");
return 0;
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is a pointer in c plus plus?
In which language linux is written?
What are identifiers in c?
When is the “void” keyword used in a function?
What is the use of #include in c?
How do I get an accurate error status return from system on ms-dos?
Can a variable be both constant and volatile?
Why is c called "mother" language?
write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.
What is non linear data structure in c?
What is conio h in c?
What is the most efficient way to store flag values?
What is far pointer in c?
What does #pragma once mean?
any "C" function by default returns an a) int value b) float value c) char value d) a & b