write a Program to dispaly upto 100 prime numbers(without
using Arrays,Pointer)

Answer Posted / satwant singh

#include<stdio.h>
#include<conio.h>
void main()
{
long int a,b,i;
clrscr();
printf("enter start no");
scanf("%ld",&a) ;
printf("enter last no");
scanf("%ld",&b);
for(i=a;i<=b;i++)
{
if((i%2==0)||(i%3==0)||(i%5==0)||(i%7==0))
{
//printf("not prime==%ld",i);
}
else
printf("its prime==%ld\n",i);
}

getch();

}

Is This Answer Correct ?    5 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

When should the const modifier be used?

673


What is 2 d array in c?

576


What is the difference between malloc() and calloc() function in c language?

623


What is structure packing in c?

629


Which is best book for data structures in c?

614






What are dangling pointers? How are dangling pointers different from memory leaks?

650


What is a class c rental property?

641


What does d mean?

609


Why do we use return in c?

581


Explain how do you determine whether to use a stream function or a low-level function?

647


What is strcmp in c?

616


Why is structure padding done in c?

667


What is p in text message?

557


What is #include stdio h and #include conio h?

614


If one class contains another class as a member, in what order are the two class constructors called a) Constructor for the member class is called first b) Constructor for the member class is called second c) Only one of the constructors is called d) all of the above

632