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

How can I find the modification date and time of a file?

614


Explain how can I avoid the abort, retry, fail messages?

599


How to implement a packet in C

2405


Device an algorithm for weiler-atherton polygon clipping, where the clipping window can be any specified polygon

5470


Write a program to check whether a number is prime or not using c?

586






Why is c so popular?

664


Explain argument and its types.

614


Are bit fields portable?

693


What is the role of this pointer?

561


What is malloc return c?

608


Explain 'bus error'?

573


Why header file is used in c?

587


What is the use of clrscr?

609


Write a program to print numbers from 1 to 100 without using loop in c?

654


Why are algorithms important in c program?

630