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
Define C in your own Language.
how to construct a simulator keeping the logical boolean gates in c
what are the program that using a two dimensional array that list the odd numbers and even numbers separately in a given 10 inputs values
What is array within structure?
What does calloc stand for?
How can I write a function that takes a format string and a variable number of arguments?
int main() { Int n=20,i; For(i=0;i<=n;i--) { Printf(“-“); Return 0;
Is linux written in c?
What are the preprocessor categories?
please explain clearly about execution of c program in detail,in which stage are the printf sacnf getting into exeecutable code
How can you find out how much memory is available?
If the size of int data type is two bytes, what is the range of signed int data type?
What is a macro in c preprocessor?
What is assignment operator?
What are the back slash character constants or escape sequence charactersavailable in c?