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 do you use macro?
What does %p mean?
Why is c called a mid-level programming language?
What are operators in c?
Explain About fork()?
What will the preprocessor do for a program?
What is the 'named constructor idiom'?
What is the use of define in c?
any C program contains only one function, it must be a) void () b) main () c) message () d) abc ()
How can a string be converted to a number?
Explain how can you check to see whether a symbol is defined?
Write a program to check palindrome number in c programming?
Explain what is the most efficient way to store flag values?
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 the scope of local variable in c?