write the program for prime numbers?
Answer Posted / varun raj s p
#include<stdio.h>
int main()
{
int n, i = 3, count, c;
printf("Enter the number of prime numbers required\n");
scanf("%d",&n);
if ( n >= 1 )
{
printf("First %d prime numbers are :\n",n);
printf("2\n");
}
for ( count = 2 ; count <= n ; )
{
for ( c = 2 ; c <= i - 1 ; c++ )
{
if ( i%c == 0 )
break;
}
if ( c == i )
{
printf("%d\n",i);
count++;
}
i++;
}
return 0;
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
i have to apply for the rbi for the post of officers. i need to know abt the entrance questions whether it may be aps or techinical....
Can i use “int” data type to store the value 32768? Why?
Write a program to print "hello world" without using a semicolon?
What is the default value of local and global variables in c?
A text file that contains declarations used by a group of functions,programs,or users a) executable file b) header file c) obj file d) .cfile
Is that possible to add pointers to each other?
Can we use visual studio for c?
How can you call a function, given its name as a string?
What is the general form of a C program?
What is the difference between arrays and pointers?
What are the advantages of union?
Please send me WIPRO technical question to my mail ID.. its nisha_g28@yahoo.com please its urgent
What is the size of enum in c?
Compare array data type to pointer data type
Write a code to achieve inter processor communication (mutual exclusion implementation pseudo code)?