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


Please Help Members By Posting Answers For Below Questions

What is ambagious result in C? explain with an example.

2058


What is assert and when would I use it?

581


Explain what is a const pointer?

642


Why structure is used in c?

597


What is switch in c?

649






Why is c not oop?

540


How many types of errors are there in c language? Explain

574


WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?

1860


What does 3 mean in texting?

618


Explain what does it mean when a pointer is used in an if statement?

618


How do you define a function?

584


I have a varargs function which accepts a float parameter?

581


Can stdout be forced to print somewhere other than the screen?

627


What is a stream water?

659


List the difference between a 'copy constructor' and a 'assignment operator' in C?

640