Write a program to print all the prime numbers with in the
given range

Answer Posted / don

#include<stdio.h>
#include<conio.h>

main()
{
int i, p, q;
int count;
printf("Enter lower Limit: ");
scanf("%d",&p);
printf("Enter Upper Limit: ");
scanf("%d",&q);
i=p;
while(i<=q)
{
for(count=2; count<i; count++)
{
if(i%count == 0)
goto line;
else
continue;
}
printf("%d ",i);
line: i++;
}

getch();
}

Is This Answer Correct ?    6 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain goto?

945


What is function definition in c?

810


What is the use of structure padding in c?

829


What is the translation phases used in c language?

871


What are the scope of static variables?

865


When a c file is executed there are many files that are automatically opened what are they files?

852


What are register variables in c?

828


Is boolean a datatype in c?

792


What is pointer & why it is used?

845


What is the time and space complexities of merge sort and when is it preferred over quick sort?

897


find out largest elemant of diagonalmatrix

1916


Write a C program to help a HiFi’s Restaurant automate its breakfast billing system. Your assignment should implement the following items: a. Show the customer the different breakfast items offered by the HiFi’s Restaurant. b. Allow the customer to select more than one item from the menu. c. Calculate and print the bill to the customer. d. Produce a report to present your complete program and show more sample output. Assume that the HiFi’s Restaurant offers the following breakfast menu: Plain Egg $2.50 Bacon and Egg $3.45 Muffin $2.20 French Toast $2.95 Fruit Basket $3.45 Cereal $0.70 Coffee $1.50 Tea $1.80

2873


Is struct oop?

799


What is your stream meaning?

884


Define Array of pointers.

868