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 bubble sort in c?
What are the types of unary operators?
What are the types of pointers in c?
What are the advantage of c language?
Explain what are the __date__ and __time__ preprocessor commands?
When I tried to go into a security sites I am denied access and a message appeared saying 'applet not initialize'. How can I rectify this problem.
When is a null pointer used?
What is LINKED LIST? How can you access the last element in a linked list?
write a program in C that prompts the user for today's date,tomorrow's date and display the results.Use structures for today's date,tomorrow's date and an array to hold the days for each month of the year.
Explain the difference between structs and unions in c?
What is getche() function?
What is register variable in c language?
how many key words availabel in c a) 28 b) 31 c) 32
hi, which software companys will take,if d candidate's % is jst 55%?
A banker has a seif with a cipher. Not to forget the cipher, he wants to write it coded as following: each digit to be replaced with the difference of 9 with the current digit. The banker chose a cipher. Decipher it knowing the cipher starts with a digit different than 9. I need to write a program that takes the cipher from the keyboard and prints the new cipher. I thought of the following: Take the input from the keyboard and put it into a string or an array. Go through the object with a for and for each digit other than the first, substract it from 9 and add it to another variable. Print the new variable. Theoretically I thought of it but I don't know much C. Could you give me any kind of hint, whether I am on the right track or not?