int sum = 0;
Console.Write("Enter Value Number:\t");
int num = Convert.ToInt32(Console.ReadLine());
for (int x = 1; x <= num; x++)
{
for (int y = 1; y <= x; y++)
Console.Write(y);
sum += x;
Console.Write("\n");
}
Console.Write( sum);
Console.ReadKey();
hello guyz how should i get the output?
the output should be like this:
Enter Value Number: 2
1
12
The sum total is : 4.
here is my code
int sum = 0;
Console.Write("Enter Value Number:\t");
int num = Convert.ToInt32(Console.ReadLine());
for (int x = 1; x <= num; x++)
{
for (int y = 1; y <= x; y++)
Console.Write(y);
sum += x;
Console.Write("\n");
}
Console.Write( sum);
Console.ReadKey();