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
Where we use clrscr in c?
Linked list is a Linear or non linear explain if linear how it working as a non linear data structures
write a progrmm in c language take user interface generate table using for loop?
What is the difference between ++a and a++?
Write a program to print “hello world” without using semicolon?
How can I access an I o board directly?
What is the use of bitwise operator?
What is the difference between far and near in c?
What is abstract data structure in c?
how can i access hard disk address(physical address)? are we access hard disk by using far,near or huge pointer? if yes then please explain.....
Explain zero based addressing.
How can you find out how much memory is available?
What is class and object in c?
Explain what are compound statements?
Can we compile a program without main() function?