Write a program that computes the value of a+aa+aaa+aaaa with a given digit as the value of a in C#. Write a C# program that accepts an integer (n) and computes the value of n+nn+nnn. C# Code: C# class Program { static void...
Tag - C# For Loop Exercices
Square pyramidal number (Sum of squares) of first n natural numbers in C#
In mathematics, a pyramid number, or square pyramidal number, is a figurate number that represents the number of stacked spheres in a pyramid with a square base. Square pyramidal numbers also solve the problem of counting the...
Display Even Numbers Between 1 to N Using For Loop in C#
Write a C# Console Application program to print even numbers between 1 to N using for loop. C# Code: C# static void Main(string[] args) { Console.Write("Number : "); int number = Convert.ToInt32(Console.ReadLine()); for (int i =...
Display Odd Numbers Between 1 to N Using For Loop in C#
Write a C# Console Application program to print odd numbers between 1 to N using for loop. C# Code: C# static void Main(string[] args) { Console.Write("Number : "); int number = Convert.ToInt32(Console.ReadLine()); for (int i =...
Display Odd Numbers Between 1 to 100 Using For Loop in C#
Write a C# Console Application program to print odd numbers between 1 to 100 using for loop. C# Code: C# static void Main(string[] args) { for (int i = 1; i <= 100; i++) { if(i%2==1) { Console.WriteLine(i); } } Console...
Display Even Numbers Between 1 to 100 Using For Loop in C#
Write a C# Console Application program to print even numbers between 1 to 100 using for loop. C# Code: C# static void Main(string[] args) { for (int i = 1; i <= 100; i++) { if(i%2==0) { Console.WriteLine(i); } } Console...