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 use of a ‘ ’ character?
in linking some of os executables are linking name some of them
What are types of preprocessor in c?
Write a program to show the change in position of a cursor using c
Explain the difference between malloc() and calloc() in c?
Explain why can’t constant values be used to define an array’s initial size?
can we change the default calling convention in c if yes than how.........?
Explain the Difference between the New and Malloc keyword.
If a variable is a pointer to a structure, then which operator is used to access data members of the structure through the pointer variable?
Is there a built-in function in C that can be used for sorting data?
What is scope of variable in c?
How can I list all of the predefined identifiers?
What are examples of structures?
differentiate built-in functions and user – defined functions.
how to write optimum code to divide a 50 digit number with a 25 digit number??