Cube series without using power maths function in c#.
Cube series:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace For_Loop_lab6
{
class Program
{
static void Main(string[] args)
{
DateTime dt = DateTime.Now;
Console.WriteLine("{0}",dt);
int num,result;
Console.WriteLine("Enter Random Number:");
num = Convert.ToInt32(Console.ReadLine());
for (int i = 1; i <= num; i++)
{
result = i*i*i;
Console.WriteLine("Cube Root of {0} is {1}",i,result);
}
}
}
}
Comments
Post a Comment