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
What is self-referential structure in c programming?
Explain about C function prototype?
What is the use of c language in real life?
What does %c mean in c?
Explain what are the standard predefined macros?
Differentiate between #include<...> and #include '...'
What are global variables and how do you declare them?
How #define works?
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)
Why main is not a keyword in c?
What is a union?
What is the significance of an algorithm to C programming?
What is oops c?
pgm to find number of words starting with capital letters in a file(additional memory usage not allowed)(if a word starting with capital also next letter in word is capital cann't be counted twice)
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.