write the program for prime numbers?
Answer Posted / ankish jaiswal
#include<stdio.h>
#include<conio.h>
int main()
{
int r,a,b,c=0;
printf("Enter the n value:");
scanf("%d",&r);
a=0;
while(a<=r)
{
b=1;c=0;
while(b<=a)
{
if(a%b==0)
c=c+1;
b++;
}
if(c==2)
printf("%d ",a);
a++;
}
getch();
return 0;
}
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result
What is identifier in c?
What is the acronym for ansi?
1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. 2) the Event Manager has to send participants to the stage to perform in the order in which they registered. Write a program that will help the Event Manager know who to call to the stage to perform. The Logic should be in Data Structures
Explain the difference between ++u and u++?
code for replace tabs with equivalent number of blanks
Explain how can I convert a number to a string?
Do you know the difference between malloc() and calloc() function?
What is the difference between exit() and _exit() function in c?
where are auto variables stored? What are the characteristics of an auto variable?
What is assert and when would I use it?
write a program to print largest number of each row of a 2D array
Explain how can you tell whether two strings are the same?
How can I find the modification date and time of a file?
What is the behavioral difference when include header file in double quotes (“”) and angular braces (<>)?