Here is a sample program that I wrote using Microsoft C# programming language that will ask the user to give a number and then our program will compute the square and cube equivalent of the given number by our user.
Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
Sample Program Output
Program Listing
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
/* Square and Cube Number Solver Using Methods */
/* Author : Mr. Jake R. Pomperada, MAED-IT */
/* Date : December 3, 2016 Saturday 10:42 AM */
/* Tool : C# */
namespace square_cube_number
{
class square_cube_number
{
// Method Square a Number
static public int square_number(int a)
{
return a * a;
}
// Method Cube a Number
static public int cube_number(int a)
{
return a * a * a;
}
static void Main(string[] args)
{
int val_1 = 0;
int solve_square = 0;
int solve_cube = 0;
Console.Write("\n\n");
Console.Write("\t SQUARE AND CUBE NUMBER SOLVER USING METHODS ");
Console.Write("\n\n");
Console.Write("Give a Number : ");
val_1 = Convert.ToInt32(Console.ReadLine());
solve_square = square_number(val_1);
solve_cube = cube_number(val_1);
Console.Write("\n\n");
Console.Write("The given number is {0} it's square equivalent is {1}." ,val_1,solve_square);
Console.Write("\n\n");
Console.Write("The given number is {0} it's cube equivalent is {1}.", val_1, solve_cube);
Console.Write("\n\n\n");
Console.Write("Thank You For Using This Software.");
Console.Write("\n\n");
Console.ReadLine();
}
}
}