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 is constructor in oop?
What is inheritance in oop?
What does enum stand for?
Why is destructor used?
Can destructor be overloaded?
What is object and class in oops?
What is difference between polymorphism and inheritance?
What is difference between pop and oop?
what is the sylabus for priliminaries?
What is the point of oop?
if i have same function with same number of argument but defined in different files. Now i am adding these two files in a third file and calling this function . which will get called and wht decide the precedence?
Write A Program to find the ambiguities in Multiple Inheritance? How are they resolved.(Virtual Functions)
Why do we use polymorphism in oops?
This program numbers the lines found in a text file. Write a program that reads text from a file and outputs each line preceded by a line number. Print the line number right-adjusted in a field of 3 spaces. Follow the line number with a colon, then one space, then the text of the line. You should get a character at a time and write code to ignore leading blanks on each line. You may assume that the lines are short enough to fit within a line on the screen. Otherwise, allow default printer or screen output behavior if the line is too long (i.e., wrap or truncate). A somewhat harder version determines the number of spaces needed in the field for the line numbers by counting lines before processing the lines of the file. This version of the program should insert a new line after the last complete word that will fit within a 72-character line.
Why is abstraction used?