write a Program to dispaly upto 100 prime numbers(without
using Arrays,Pointer)
Answer Posted / nachiyappan
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,c,n=1;
clrscr();
for(i=1;i<=100;i++)
{
n=n+1;
c=0;
for(j=1;j<=n;j++)
{
if(n%j==0)
c=c+1;
}
if(c==2)
printf("no. %d is prime",n);
else
printf("no. %d is not prime",n);
}
getch();
}
| Is This Answer Correct ? | 33 Yes | 11 No |
Post New Answer View All Answers
Explain how can I remove the trailing spaces from a string?
What is c programming structure?
Explain what header files do I need in order to define the standard library functions I use?
in iso what are the common technological language?
In this problem you are to write a program that will cut some number of prime numbers from the list of prime numbers between 1 and N.Your program will read in a number N; determine the list of prime numbers between 1 and N; and print the C*2 prime numbers from the center of the list if there are an even number of prime numbers or (C*2)-1 prime numbers from the center of the list if there are an odd number of prime numbers in the list.
What are pointers?
What is the size of structure in c?
When should volatile modifier be used?
Write a program to find factorial of a number using recursive function.
What is the mean of function?
All technical questions
What is a structure in c language. how to initialise a structure in c?
In C, What is the #line used for?
What is the use of pointers in C?
How can I access an I o board directly?