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
How can I find the modification date and time of a file?
Explain how can I avoid the abort, retry, fail messages?
How to implement a packet in C
Device an algorithm for weiler-atherton polygon clipping, where the clipping window can be any specified polygon
Write a program to check whether a number is prime or not using c?
Why is c so popular?
Explain argument and its types.
Are bit fields portable?
What is the role of this pointer?
What is malloc return c?
Explain 'bus error'?
Why header file is used in c?
What is the use of clrscr?
Write a program to print numbers from 1 to 100 without using loop in c?
Why are algorithms important in c program?