write a Program to dispaly upto 100 prime numbers(without
using Arrays,Pointer)
Answer Posted / faizan n
/*A program to print all primes b\w 1-100*/
#include<stdio.h>
#include<conio.h>
void main()
{
int count,i=1;
int a;
int col=0;
clrscr();
for(i=1; i<101; i++)
{
count=0;
a=1;
while(a<=i)
{
if(i%a==0)
count++;
a++;
}
if(count==2)
{
printf("%d\t",i);
col++;
if(col%10==0)
printf("\n");
}
}
getch();
}
| Is This Answer Correct ? | 7 Yes | 5 No |
Post New Answer View All Answers
Why is it important to memset a variable, immediately after allocating memory to it ?
What is size of union in c?
What is a c token and types of c tokens?
What is the translation phases used in c language?
What is the difference between typedef struct and struct?
count = 0; for (i = 1;i < = 10; i++);count = count + i; Value of count after execution of the above statements will be a) 0 b) 11 c) 55 d) array
PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE
In C language, a variable name cannot contain?
What are the preprocessor categories?
How can you determine the size of an allocated portion of memory?
In C programming, what command or code can be used to determine if a number of odd or even?
Is javascript based on c?
Why is c still so popular?
find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2
What are the uses of a pointer?