write the program for prime numbers?
Answer Posted / sreejesh1987
//Output primes upto limit n(Give n>2)
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,n;
clrscr();
printf("\t\t\tPRIME NUMBERS\n");
printf("Enter n:");
scanf("%d",&n);
printf("\n\t2");
for(i=3;i<=n;i++)
for(j=2;j<i,i%j!=0;j++)
if(i-1==j)
printf("\n\t%d",i);
getch();
}
Is This Answer Correct ? | 11 Yes | 13 No |
Post New Answer View All Answers
What are volatile variables in c?
Which of the following operators is incorrect and why? ( >=, <=, <>, ==)
What would happen to X in this expression: X += 15; (assuming the value of X is 5)
What are the application of c?
How do you initialize pointer variables?
How to write a code for reverse of string without using string functions?
What do you know about the use of bit field?
What is the purpose of type declarations?
What is the purpose of & in scanf?
How many bytes is a struct in c?
why return type of main is not necessary in linux
Hai what is the different types of versions and their differences
What are structure types in C?
Explain with the aid of an example why arrays of structures don’t provide an efficient representation when it comes to adding and deleting records internal to the array.
What is the difference between c and python?