Write a program to print all the prime numbers with in the
given range
Answer Posted / ankit giriya
#include<stdio.h>
void main()
{
int i, prime, lim_up, lim_low, n;
clrscr();
printf(“\n\n\t ENTER THE LOWER LIMIT…: “);
scanf(“%d”, &lim_low);
printf(“\n\n\t ENTER THE UPPER LIMIT…: “);
scanf(“%d”, &lim_up);
printf(“\n\n\t PRIME NUMBERS ARE…: “);
for(n=lim_low+1; n<lim_up; n++)
{
prime = 1;
for(i=2; i<n; i++)
if(n%i == 0)
{
prime = 0;
break;
}
if(prime)
printf(“\n\n\t\t\t%d”, n);
}
getch();
}
| Is This Answer Correct ? | 4 Yes | 5 No |
Post New Answer View All Answers
How can you convert integers to binary or hexadecimal?
Explain continue keyword in c
Why are algorithms important in c program?
What do you mean by c what are the main characteristics of c language?
What are the basic data types associated with c?
What is a floating point in c?
Explain what are its uses in c programming?
What type is sizeof?
What is the size of enum in bytes?
How many main () function we can have in a project?
What is the difference between new and malloc functions?
What is the difference between null pointer and wild pointer?
What is c language in simple words?
When should the volatile modifier be used?
Can a variable be both constant and volatile?