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
What are identifiers in c?
How can you tell whether two strings are the same?
Explain how can I make sure that my program is the only one accessing a file?
Write a C program to accept a matrix of any size. Find the frequency count of each element in the matrix and positions in which they appear in the matrix
What is null pointer constant?
What is a good data structure to use for storing lines of text?
How to write a code for implementing my own printf() and
scanf().... Please hep me in this... I need a guidance...
Can you give an coding for c... Please also explain about
the header files used other than #include
difference between native and cross compilers
How can I implement a delay, or time a users response, with sub-second resolution?
If i have an array 0 to 99 i.e,(Size 100) I place the values 1 to 100 randomly like a[0]=29,a[1]=56 upto array[99].. the values are only between 1 to 100. getting the array values by using scanf.. If i entered one wrong element value line a[56]=108. how can i find it.. and also how to find the missing value in 1 to 100.. and i want to replace the missing values.. any one of them know please post your answer..
WHICH TYPE OF JOBS WE GET BY WRITING GROUPS .WHEN THE EXAMS CONDUCTED IS THIS EXAMS ARE CONDUCTED EVERY YEAR OR NOT.PLS TELL ME THE ANSWER
Differentiate between a structure and a union.
What is mean by Data Driven framework in QTP? Can any one answer me in details on this regard.
4-Take two sets of 5 numbers from user in two arrays. Sort array 1 in ascending and array 2 in descending order. Perform sorting by passing array to a function mySort(array, sortingOrder). Then multiply both the arrays returned from function, using metric multiplication technique in main. Print result in metric format.
What header files do I need in order to define the standard library functions I use?