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();
printf(" no. 1 is neither a prime nor composite no.");
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("\n no. %d is prime",n);
else
printf("\n no. %d is not prime",n);
}
getch();
}
| Is This Answer Correct ? | 26 Yes | 8 No |
Post New Answer View All Answers
In C programming, what command or code can be used to determine if a number of odd or even?
Explain why can’t constant values be used to define an array’s initial size?
What are pointers? Why are they used?
How do you redirect a standard stream?
How is null defined in c?
What is a pointer and how it is initialized?
What is c programming structure?
What are terms in math?
Write a program to generate random numbers in c?
Explain Basic concepts of C language?
What could possibly be the problem if a valid function name such as tolower() is being reported by the C compiler as undefined?
Why void main is used in c?
What are the different types of linkage exist in c?
What is a structural principle?
How does normalization of huge pointer works?