Къде сгреших? https://judge.softuni.bg/Contests#!/List/ByCategory/13/Programming-Basics-Homework
Problem 10. Reformat C# Code Reformat the following C# code to make it readable according to the C# best practices for code formatting. Change the casing of the identifiers in the code (e.g. use PascalCase for the class name). Note: How to test in Judge System. In the bottom right corner there’s a dropdown menu. Select “Plain text” and copy/paste the whole source code. Or find a way to print it on the console (then select “C# code” from dropdown menu).
HorribleCode.cs using System;
class hoRRiblEcoDe
{ static void Main()
{
Console. WriteLine("Hi, I am horribly formatted program" );
Console. WriteLine("Numbers and squares:") ;
for (int i = 0; i < 10; i++)
{
Console.WriteLine(i + " --> " + i * i);
}
}
My solution:
using System;
class HorribleCode
{ static void Main()
{
Console.WriteLine("Hi, I am horribly formatted program");
Console.WriteLine("Numbers and squares:");
for (int i = 0; i < 10; i++)
{
Console.WriteLine(i + " --> " + i * i);
}
}
My output:
Hi, I am horribly formatted program Numbers and squares:
0 --> 0
1 --> 1
2 --> 4
3 --> 9
4 --> 16
5 --> 25
6 --> 36
7 --> 49
8 --> 64
9 --> 81
Press any key to continue . . .
Expected output:
using System;
class HorribleCode
{ static void Main()
{ Console.WriteLine("Hi, I am horribly formatted program");
Console.WriteLine("Numbers and squares:");
for (int i = 0; i < 10; i++)
{
Console.WriteLine(i + " --> " + i * i);
}
}
Благодаря за помощта! Отговорът на моя въпрос се оказа, че го има в условието на задачата!!!
(Note: How to test in Judge System. In the bottom right corner there’s a dropdown menu. Select “Plain text” and copy/paste the whole source code. Or find a way to print it on the console (then select “C# code” from dropdown menu).)