Question

Using C# and including comments: Name this project SquaresAndCubes Write a Console Application initializes a variable...

Using C# and including comments: Name this project SquaresAndCubes Write a Console Application initializes a variable to an integer value then prints out a table with the number, its square, and its cube. The program then adds one to the value and does the same on the next line. The program then adds one to the value again and does the same on the third line. The program then adds one to the value again and does the same on the fourth line: Example: If the value is 3 then the output should look like this: Number Square Cube 3 9 27 4 16 64 5 25 125 6 36 216

0 0
Add a comment Improve this question Transcribed image text
Answer #1

using System;

class SquaresAndCubes {

  

public static void Main (string[] args) {

// Declare the required variables

int num, square, cube;

int i;

// Take radius and length input from the user

Console.WriteLine ("Enter a number : ");

// Convert the input from the user to double value

num = int.Parse(Console.ReadLine());

for (i=1;i<=4;i++){

Console.WriteLine(num+" "+num*num+" "+num*num*num);

num += 1;

}

}

}

PLEASE RATE ANSWER

Add a comment
Know the answer?
Add Answer to:
Using C# and including comments: Name this project SquaresAndCubes Write a Console Application initializes a variable...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a C++ console application that adds the corresponding elements of two integer arrays of size...

    Write a C++ console application that adds the corresponding elements of two integer arrays of size five. Prompt the user for the ten values and store the first five in the first array and the second five in the second array. Then create and call function matrixAdd that adds the two arrays and prints the five sums. Here is the function prototype: void matrixAdd(int firstArr[], int secondArr[]); [your program code here]*

  • Write a Java console application that prompts the user to enter the radius of a circle,...

    Write a Java console application that prompts the user to enter the radius of a circle, then prints its radius, diameter, circumference, and area. Write a JavaFX GUI application to do the same calculation, and draw the circle. The Console Output Enter the radius of the circle: 1.2 The radius is 1.2 The diameter is 2.4 The circumference is 7.5398223686155035 The area is 4.523893421169302 Write and document your program per class coding conventions. Add an instance variable double radius. Generate...

  • Write a complete Java program, including comments in both the main program and in each method,...

    Write a complete Java program, including comments in both the main program and in each method, which will do the following: 0. The main program starts by calling a method named introduction which prints out a description of what the program will do. This method is called just once.      This method is not sent any parameters, and it does not return a value. The method should print your name. Then it prints several lines of output explaining what the...

  • #include <iostream> using namespace std; int main() {    } Write a program that, given a...

    #include <iostream> using namespace std; int main() {    } Write a program that, given a user-specified integer, prints out the next 10 integers (in increasing order; each on its own line). For example, given an input of 3, the console content following a run of the completed program will look as follows: Enter a number: 3 4 5 6 7 8 9 10 11 12 13

  • Write a C++ console application that uses functions to calculate an employee’s salary.

    Write a C++ console application that uses functions to calculate an employee’s salary.PART 1: Create a void function to print a menu asking the user to choose from the following options:1 - Annual salary2 - Monthly salary3 - Daily rate of pay4 – ExitThe void function only prints the menu. Format your cout statement to include the menu as displayed above.If the chosen option is 1- Annual Salary, ask the user for the number of hours they work perweek and...

  • Include outputs. Write a C# console application named Tape that includes fields for length and width...

    Include outputs. Write a C# console application named Tape that includes fields for length and width in inches and properties for each field. Also include a ToString() method that returns a string constructed from the return value of the object's GetType() method and the values of the length and width fields. Derive two subclasses - VideoCassetteTape and AdhesiveTape. The VideoCassetteTape class includes an integer field to hold playing time in minutes - a value from 1 to 180 - and...

  • Count Occurrences in Seven Integers Using Java Single Dimension Arrays In this assignment, you will design...

    Count Occurrences in Seven Integers Using Java Single Dimension Arrays In this assignment, you will design and code a Java console application that reads in seven integer values and prints out the number of occurrences of each value. The application uses the Java single dimension array construct to implement its functionality. Your program output should look like the sample output provided in the "Count Occurrences in Seven Integers Using Java Single Dimension Arrays Instructions" course file resource. Full instructions for...

  • using c/c++ Q1 (15 Marks) Console Application for Student Data 1- Write a function named Average...

    using c/c++ Q1 (15 Marks) Console Application for Student Data 1- Write a function named Average that Receives two integer numbers as parameter and returns the average Is used in a main function. Main() stays in a loop and asks user to enter 2 numbers and then shows the average using the Average function above Define a class named Student with following members: private data: 2 grades and a GPA (average). public constructor to initialize the members a public function...

  • CISC 1115 Assignment 6 Write a complete program, including javadoc comments, to process voter statistics Input...

    CISC 1115 Assignment 6 Write a complete program, including javadoc comments, to process voter statistics Input to Program: A file containing lines of data, such that each line has 2 integers on it The first integer represents a zip code (in Brooklyn or the Bronx), and the second represents the number of voters in that zip code. Output: All output may be displayed to the screen. In main: 1. Your program will read in all of the data in the...

  • Skills Needed: cin, cout, constants, arithmetic expressions, rounding, int main, meaningful variable names, spacing, indentation, documentation,...

    Skills Needed: cin, cout, constants, arithmetic expressions, rounding, int main, meaningful variable names, spacing, indentation, documentation, output. Computing Basic Geometric Formulas Write a program to compute answers to some basic geometry formulas. The program prompts the user to input a length (in centimeters) specified as a floating point value. The program then echoes the input and computes areas of squares and circles and the volume of a cube. For the squares, you will assume that the input length value is...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT