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
a c variable cannot start with a) an alphabet b) a number c) a special symbol d) both b and c above
Why does the call char scanf work?
explain what is a newline escape sequence?
What is a protocol in c?
in linking some of os executables are linking name some of them
What is struct node in c?
The number of bytes of storage occupied by short, int and long are a) 2, 2 and 4 b) 2, 4 and 4 c) 4, 4 and 4 d) none
How do I copy files?
What is selection sort in c?
Difference between Shallow copy and Deep copy?
a=10;b= 5;c=3;d=3; if(a printf(%d %d %d %d a,b,c,d) else printf("%d %d %d %d a,b,c,d);
GIven a sequence of characters. How will you convert the lower case characters to upper case characters. ( Try using bit vector - sol given in the C lib -> typec.h)
what do u mean by Direct access files? then can u explain about Direct Access Files?
Write a program to print ASCII code for a given digit.
What is declaration and definition in c?