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
Tell me is null always defined as 0(zero)?
Some coders debug their programs by placing comment symbols on some codes instead of deleting it. How does this aid in debugging?
What are the 4 types of organizational structures?
i want to switch my career from quailty assurance engineering to development kindly guide me from which programming language its better for me to start plz refer some courses or certifications too i have an experience of 1.5 yrs in QA field.Kindly guide me
How does free() know explain how much memory to release?
What is the difference between text and binary modes?
Explain how can I convert a number to a string?
Is struct oop?
How to find a missed value, if you want to store 100 values in a 99 sized array?
Write a c program to build a heap method using Pointer to function and pointer to structure ?
What is structure in c language?
Can static variables be declared in a header file?
What is void pointers in c?
Explain what is a static function?
What are the advantages of union?