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
Explain how does free() know explain how much memory to release?
Are c and c++ the same?
What is the difference between functions abs() and fabs()?
What is d scanf?
Are pointers integer?
What is a string?
What 'lex' does?
A c program to display count values from 0 to 100 and flash each digit for a secong.reset the counter after it reaches 100.use for loop,. pls guys hepl me.. :(
Write a C++ program to generate 10 integer numbers between - 1000 and 1000, then store the summation of the odd positive numbers in variable call it sum_pos, then find the maximum digit in this variable regardless of its digits length.
What is identifier in c?
Why isn't any of this standardized in c? Any real program has to do some of these things.
What does sizeof function do?
What is the difference between array and pointer in c?
What does c mean before a date?
Write a program to produce the following output: 1 2 3 4 5 6 7 8 9 10