Write a program to print all the prime numbers with in the
given range
Answer Posted / om
void find_primenumber_in_range(int r1,int r2)
{
int i,j;
for(i=r1;i<=r2;i++)
{
for(j=2; j<=(i/2); j++)
if(i%j==0)
break;
if(j== (i/2 +1))
printf("%d\t",i);
}
}
Is This Answer Correct ? | 31 Yes | 21 No |
Post New Answer View All Answers
What is a good data structure to use for storing lines of text?
What is getch() function?
What is the use of getch ()?
Can a pointer be volatile in c?
List the variables are used for writing doubly linked list program.
I need a help with a program: Write a C program that uses data input in determining the whole of points A and a whole of circles B. Find two points in A so that the line which passes through them, cut through the maximum number of circles.
What are all different types of pointers in c?
What is an lvalue in c?
What is the purpose of macro in C language?
Is Exception handling possible in c language?
Explain what is the difference between a string and an array?
What is the difference between union and structure in c?
What does typeof return in c?
What is the benefit of using const for declaring constants?
Write a C program that will accept a hexadecimal number as input and then display a menu that will permit any of the following operations to be carried out: Display the hexadecimal equivalent of the one's complement. (b) Carry out a masking operation and then display the hexadecimal equivalent of the result. (c) Carry out a bit shifting operation and then display the hexadecimal equivalent of the result. (d) Exit. If the masking operation is selected, prompt the user lor the type of operation (bitwise and, bitwise exclusive or, or bitwise or) and then a (hexadecimal) value for the mask. If the bit shifting operation is selected. prompt the user for the type of shift (left or right), and then the number of bits. Test the program with several different (hexadecimal) input values of your own choice.