How can i write a code in c# to take a number from the user
and then find all the prime numbers till the number entered
by the user.
Answer Posted / guest
for(i=0;i<n;i++)
{
if(i==1||i==2||i==3||i==5||i==7)
{
printf("No is prime");
}
else if(i%2==0&&i%3==0&&i%5==0&&i%7==0)
{
printf("No is prime");
}
else
printf("No is not prime");
}
Is This Answer Correct ? | 5 Yes | 9 No |
Post New Answer View All Answers
What are objects in oop?
Will I be able to get a picture in D drive to the c++ program? If so, help me out?
What is meant by multiple inheritance?
What do you mean by overloading?
What is class encapsulation?
What is constructor overloading in oop?
What is the importance of oop?
What is the point of polymorphism?
IS IT NECESSARY TO INITIALIZE VARIABLE? WHAT IF THE INSTANCE VARIABLE IS DECLARED final ? IS IT NECESSARY TO INITIALIZE THE final VARIABLE AT THE TIME OF THEIR DECLARATION?
Why polymorphism is used in oops?
What does I oop mean?
Is data hiding and abstraction same?
Why do we need oop?
What does sksksk mean in text slang?
What is the fundamental idea of oop?