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
How do you write a program which produces its own source code as output?
a way in which a pointer stores the address of a pointer which stores the value of the target value a) reference b) allocation c) multiple indirection d) none
How can I direct output to the printer?
Suppose we have a table name EMP as below. We want to perform a operation in which, I want to change name ‘SMITH’ from as ‘SMITH JAIN’. Also I want to change the name of the column from ENAME to E_NAME. EMPNO ENAME JOB MGR HIREDATE SAL 7369 SMITH Coder 7902 17-DEC-80 800 7499 ALLEN SALESMAN 7698 20-FEB-81 1600 7521 WARD SALESMAN 7698 22-FEB-81 1250
Is linux written in c?
What are register variables? What are the advantage of using register variables?
What are reserved words?
What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?
Why isn't any of this standardized in c? Any real program has to do some of these things.
what is the difference between class and unio?
what is reason of your company position's in india no. 1.
hi, which software companys will take,if d candidate's % is jst 55%?
What is the benefit of using an enum rather than a #define constant?
What is pointers in c with example?
What are the main characteristics of c language describe the structure of ac program?