write the program for prime numbers?
Answer Posted / farhana parvin sunny
#include<stdio.h>
int main()
{
int i,j,n,f=0;
printf("Enter the length\n");
scanf("%d",&n);
for(i=2;i<=n;i++)
{
for(j=2;j<i;j++)
{
if((i%j)==0)
{
f=1;
break;
}
f=0;
}
if(f==0)
printf("%d ",i);
}
}
Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
The program will first compute the tax you owe based on your income. User is prompted to enter income. Program will compute the total amount of tax owed based on the following: Income Tax 0 - $45,000 = 0.15 x income $45,001 - $90,000 = 6750 + 0.20 x (income – 45000) $90,001 - $140,000 = 15750 + 0.26 x (income – 90000) $140,001 - $200,000 = 28750 + 0.29 x (income – 140000) Greater than $200,000 = 46150 + 0.33 x (income – 200000) Dollar amounts should be in dollars and cents (float point numbers with two decimals shown). Tax is displayed on the screen.
What are the advantages of c preprocessor?
how to construct a simulator keeping the logical boolean gates in c
Explain goto?
What are the similarities between c and c++?
Why isn't it being handled properly?
What are the scope of static variables?
Write program to remove duplicate in an array?
Program to find the sum of digits of a given number until the sum becomes a single digit. (e.g. 12345=>1+2+3+4+5=15=>1+5=6)
What is character set?
Explain how can you avoid including a header more than once?
What does c mean in basketball?
How can I make it pause before closing the program output window?
the question is that what you have been doing all these periods (one year gap)
What are the types of functions in c?