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
Which header file is essential for using strcmp function?
What is adt in c programming?
int i[2], j; int *pi;i[0] = 1; i[1] = 5; pi = i; j = *pi + 1 + *(pi + 1)Value of j after execution of the above statements will be a) 7 b) 6 c) 4 d) pointer
explain what is fifo?
What is array in c with example?
What is the right way to use errno?
Explain zero based addressing.
Explain how can you tell whether a program was compiled using c versus c++?
What are variables c?
Is there a way to jump out of a function or functions?
How can I determine whether a machines byte order is big-endian or little-endian?
List the difference between a "copy constructor" and a "assignment operator"?
What is an expression?
Difference between macros and inline functions? Can a function be forced as inline?
What is a lvalue