Need to be solved in c#
Write the program using the method that calculates the cube of numbers from 1 to 9 that comes as a parameter to it as a series.
Aim : To write a c# program using the method that calculates the cube of numbers from 1 to 9.
Source code :
using System;
using System.Linq;
using System.Collections.Generic;
public class CalCube {
public static void cube(List<int>
list){//method to find the cubes
IEnumerable<int>
res = list.AsQueryable().Select(c => c * c * c);// cube of each
element
Console.WriteLine("Cube
of each element...");
foreach (int n in
res)//loop to print Cube of each element
Console.WriteLine(n);
}
public static void Main() {
CalCube d=new
CalCube();
List<int> list =
new List<int> {1, 2, 3, 4, 5, 6, 7,8, 9 };
//Console.WriteLine("Elements...");
//foreach (int n in
list) //loop to print given elements
//Console.WriteLine(n);
CalCube.cube(list);
//invoking the cube method
}
}
"Refer the below screenshot of the code to understand the indentation of the code"
Sample output :
This is how we can write a program using the method that calculates the cube of numbers from 1 to 9 that comes as a parameter to it as a series.
Need to be solved in c# Write the program using the method that calculates the cube...
Request this to be done in JGrasp 1.Add a method to the program that calculates the cube of every number between a lower bound and an upper bound that a user inputs (for instance, lower bound 1 and upper bound 9, for between 1 and 9). 2. Write an additional method that return the cubed value of an integer 3.Write an additional method to accomplish the same thing in #1, but this time calls the method you wrote in #2
5. (30 pts) Write a program that calculates the surface area of a cube (see the formula below). The user inputs the cube's side length and your program will then print out the surface area of that cube. Your code must follow the output in the sample run below. Your program must be complete and correct, but you do not need to include comments. Here is the formula to calculate surface area given a cube's side length: surface area 6...
Write a Visual Basics program that calculates the squares and cubes of the numbers 0 through 5 and displays the resulting values in table format as follow: Number Square Cube 0 0 0 1 1 1 2 4 8 3 9 27 4 16 64 5 25 125
Write in C Program.... Write a multi-threaded program that calculates various statistical values for a list of numbers. This program will be passed a series of numbers on the command line and will then create three separate worker threads. One thread will determine the average of the numbers, the second will determine the maximum value, and the third will determine the minimum value. For example, suppose your program is passed the integers 90 81 78 95 79 72 85. The...
Write a program using loop and array that asks users to input 10 numbers, then calculates the average of those numbers. (In C++)
Using the idea of inheritance and polymorphism write a C++ program that calculates the area of regular polygons. This is a typical output when the desired program is executed: >> please enter the sides of your polygon: 3,4,5 >> Your polygon is a triangle and its area is: 6 In your program, you must check that the values entered are correct and can build a polygon. The number of the digits entered initially can help software to determine the polygon...
I need to write a program in C that covers this: I need in c language Design a program with a loop that lets the user enter a series of numbers the user should enter -99 to signal the end of the series. after all the numbers have been entered, the program should display the largest and smallest numbers entered.
Part A) Write a C++ program that calculates the area under a curve. Here is the equation: f(x) = x^2 +1.5x +4 You must prompt the user for the beginning and the ending x values. You are to assume, but not check, that the user will put in whole positive numbers. The units are inches. The program input/output should look something like this: This program calculates the area under a curve between two points on the x axis. The equation...
I need this ASAP Write a SIC assembly program that calculates a+b/c Save the result to a. Use the example program in the textbook page 47 as reference.
Write a method that calculates a 15% discount on the price of an item. Have the method return the discounted price. For example if the price is $100.00 the method should return $85.00. Write the method using either returning void and using a referene parameter or write it returning the value as a double or decimal and taking a value parameter. Call the function passing it an appropriate variable. Display the result.