write the program for prime numbers?
Answer Posted / karthikeyan murugesan
hi u can try this one for prime number and generation ::
#include<stdio.h>
void main()
{
int n,i=1,j,c;
scanf("%d",&n);
while(i<=n)
{
c=0;
for(j=1;j<=i;j++)
{
if(i%j==0)
c++;
}
if(c==2)
{
printf("%d",i);
i++;
}
}
getch();
}
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
When was c language developed?
Can I initialize unions?
Difference between Function to pointer and pointer to function
Explain the advantages and disadvantages of macros.
explain how do you use macro?
How to implement a packet in C
Explain the concept and use of type void.
Hai what is the different types of versions and their differences
What does 2n 4c mean?
What does the message "automatic aggregate intialization is an ansi feature" mean?
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 different types of linkage exist in c?
What is the difference between array and structure in c?
Is javascript based on c?
Explain pointer. What are function pointers in C?