Question

In: Computer Science

Write an application named OddNums that displays all the odd numbers from 1 through 99. All...

Write an application named OddNums that displays all the odd numbers from 1 through 99. All ODD numbers should show all together(Should not need to scroll down), do it in 10 rows. FOR C#

Solutions

Expert Solution

C# code:

using System;
class OddNums{
static void Main(){
        //looping from 1 to 99
        for(int i=1;i<=99;i++){
            //checking if the number is odd
            if(i%2!=0)
                //printing the number
                Console.Write(i+" ");
            //checking to the row is filled
            if(i%10==0)
                //printing a newline
                Console.WriteLine();
        }
    }
}


Screenshot:


Output:


Related Solutions

In C# Please Write an application named Perfect that displays every perfect number from 1 through...
In C# Please Write an application named Perfect that displays every perfect number from 1 through 10,000. A number is perfect if it equals the sum of all the smaller positive integers that divide evenly into it. For example, 6 is perfect because 1, 2, and 3 divide evenly into it and their sum is 6. Starting code. using static System.Console; class Perfect { static void Main() { // Write your main here. } }
Use a For loop to compute the sum of all the odd numbers from 1 through...
Use a For loop to compute the sum of all the odd numbers from 1 through 99. Your result should be labeled, and the value should be 2500. Print your name 7 times using a While loop. String dogNames[ ] = {"Sam","Buster","Fido","Patches","Gromit","Flicka"}; Using the array defined here, print the values of the array vertically and horizontally using one For-Each loop. Reverse the logic for zyBook Challenge activity 4.6.1 (Nested loops: Indent text) so that the first line is indented userNum...
Write down a while loop that calculates and displays the SQUARE of ten ODD numbers (from...
Write down a while loop that calculates and displays the SQUARE of ten ODD numbers (from 1 to 19) in a loop style execution: C++
Write a MIPS Assembly program that computes the sum of all the odd numbers from 1...
Write a MIPS Assembly program that computes the sum of all the odd numbers from 1 ..99 and print out the answer.
Write an application named DisplayMultiplicationTable that displays a table of the products of every combination of...
Write an application named DisplayMultiplicationTable that displays a table of the products of every combination of two integers from 1 through 10 Beginning Code. Please answer in C# using static System.Console; class DisplayMultiplicationTable { static void Main() { // Write your main here. } } }
Write a program in C++ that generates and displays the first N three digit odd numbers....
Write a program in C++ that generates and displays the first N three digit odd numbers. Whereas the number N is provided by the user.
Java Write a program that displays all the numbers from 100 to 200 that are divisible...
Java Write a program that displays all the numbers from 100 to 200 that are divisible by 5 or 6, but not both Make sure all instructions and outputs for the user are explicit
Lab 1 – Numbers in Descending Order Design an application that accepts 10 numbers and displays...
Lab 1 – Numbers in Descending Order Design an application that accepts 10 numbers and displays them in descending order For the programming problem, create the pseudocode and enter it below. Enter pseudocode here
Write a program that checks if all the input numbers cover 1 to 99. Each ticket...
Write a program that checks if all the input numbers cover 1 to 99. Each ticket for the Pick-10 lotto has 10 unique numbers ranging from 1 to 99. Suppose you buy a lot of tickets and like to have them cover all numbers from 1 to 99. Write a program that reads the ticket numbers from a file and checks whether all numbers are covered. Assume the last ending number in the file is 0. Suppose the file contains...
Design a 4 bit Counter that displays even numbers when a switch on, and odd when...
Design a 4 bit Counter that displays even numbers when a switch on, and odd when the switch off . 1.by using multisim (explain in details and information of how you do it in multisim) show steps of multisim and which gates numbers you used.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT