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 are the data types present in c?
What is an lvalue in c?
What is a sequential access file?
How to throw some light on the b tree?
What does static variable mean in c?
hi send me sample aptitude papers of cts?
What is wrong with this declaration?
What is the size of empty structure in c?
Which built-in library function can be used to match a patter from the string?
what is the significance of static storage class specifier?
What is a pointer on a pointer in c programming language?
‘SAVEPOINT’ and ‘ROLLBACK’ is used in oracle database to secure the data comment. Give suitable examples of each with sql command.
What is a program flowchart and how does it help in writing a program?
How do c compilers work?
What are external variables in c?