i want to asked a question about c program the question is:
create a c program that displays all prime numbers less than
500? using looping statement
Answer Posted / vishnu nayak
int main()
{
unsigned int i,k;
unsigned int temp;
int count =0;
printf("enter the number \n");
scanf("%u",&i);
printf("\n");
for(temp =2;temp<i;temp++)
{
count =0;
for(k =2;k<=i;k++)
{
if((temp % k) == 0)
count++;
}
if(count <=1 )
printf("%u \n",temp);
}
getch();
}
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
what is the difference between 123 and 0123 in c?
Between macros and functions,which is better to use and why?
What are structure members?
Tell me with an example the self-referential structure?
write a program to concatenation the string using switch case?
How do you use a pointer to a function?
Does c have function or method?
What is an arrays?
What is wrong with this initialization?
List some of the dynamic data structures in C?
What does return 1 means in c?
a program that performs some preliminary processing in C, it acts upon certain directives that will affect how the compiler does its work a) compiler b) loader c) directive d) preprocessor
Explain what are global variables and explain how do you declare them?
please explain clearly about execution of c program in detail,in which stage are the printf sacnf getting into exeecutable code
Write a program to print “hello world” without using semicolon?