Please write me a program to print the first 50 prime
numbers (NOT between the range 1 -50)
Answer Posted / antony
#include<stdio.h>
void main()
{
int count=0;
int num=1;
int i;
printf("prime nums \n");
while(count<50)
{
num++;
for (i=2;i<=num-1;i)
{
if(num%i==0)break;
i++;
}
if(i>=num-1)
{
printf("%d ",num);
count++;
}
}
}
| Is This Answer Correct ? | 93 Yes | 47 No |
Post New Answer View All Answers
How do you use a 'Local Block'?
What are the different types of data structures in c?
What is the heap?
Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?
Explain what is the heap?
Is malloc memset faster than calloc?
what is the basis for selection of arrays or pointers as data structure in a program
If fflush wont work, what can I use to flush input?
What is gets() function?
What is the role of && operator in a program code?
What are the general description for loop statement and available loop types in c?
What is structure data type in c?
Why doesnt that code work?
WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?
Write programs for String Reversal & Palindrome check