write the program for prime numbers?
Answer Posted / priyanka chauhan
// prime no series. //
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,n;
clrscr();
printf("Enter the no: ");
scanf("%d",&n);
printf("\n");
for(i=1;i<=n;i++)
{
for(j=2;j<=i-1;j++)
{
if(i%j==0)
break;
}
if(j==i)
printf("%d ",j);
}
getch();
}
Is This Answer Correct ? | 173 Yes | 84 No |
Post New Answer View All Answers
Explain how are 16- and 32-bit numbers stored?
When should a type cast be used?
Can you please explain the difference between syntax vs logical error?
Explain how do you print only part of a string?
In C language, a variable name cannot contain?
What would the following code segment printint k = 8;docout << "k = " << k << " ";while k++ < 5; a) 13 b) 5 c) 8 d) pointers
What is identifiers in c with examples?
For what purpose null pointer used?
What are the properties of union in c?
Can we change the value of #define in c?
How can you find out how much memory is available?
Explain logical errors? Compare with syntax errors.
develop algorithms to add polynomials (i) in one variable
What is LINKED LIST? How can you access the last element in a linked list?
Explain high-order and low-order bytes.