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
Where You Can Use Interface in your Project
What is the important feature of inheritance?
what is the drawback of classical methods in oops?
Why can't we have instance(stack) of a class as a member of the same class like eg.Class A{A obj;} as we can have self refential pointer
Why do while loop is used?
2. Give the different notations for the class.\
What are properties in oop?
What is coupling in oop?
What is interface in oop?
Why multiple inheritance is not possible?
What is overriding vs overloading?
What is object in oop?
What is class and object in oops?
What is abstraction example?
What is polymorphism used for?