C# :: Aufgabe #301

9 Lösungen Lösungen öffentlich

Das kleine Einmaleins

Anfänger - C# von DragStar - 06.04.2020 um 08:32 Uhr
Erstellen Sie ein Programm, welches das kleine Einmaleins in der Form
1 2 3 4 5 6 7 8 9 10
2 4 6 8 10 12 14 16 18 20
3 ...
.
.
.
10 20 30 40 50 60 70 80 90 100
ausgibt.

Lösungen:

vote_ok
von JKooP (18090 Punkte) - 12.04.2020 um 14:24 Uhr
NET Core 3.x

Quellcode ausblenden C#-Code
using static System.Console;

namespace CS_Aufgabe_301_Einmaleins
{
    class Program
    {
        static void Main(string[] args)
        {
            Write($"     |");
            for (int i = 1; i < 11; i++)
                Write($"{i,4}");

            WriteLine();
            WriteLine(new string('-', 46));

            for (int k = 1; k < 11; k++)
            {
                Write($"{k,4} |");
                for (int j = 1; j < 11; j++)
                    Write($"{k*j, 4}");
                WriteLine();
            }
        }
    }
}
vote_ok
von blackliner (340 Punkte) - 13.04.2020 um 21:27 Uhr
Quellcode ausblenden C#-Code
using System;

namespace Einmaleins
{
    class Program
    {
        static void Main()
        {
            for(int n = 1; n <= 10; n++)
            {
                for (int i = 1; i <= 10; i++)
                {
                    Console.Write(n * i + " ");
                }
                Console.Write(Environment.NewLine);
            }
            Console.ReadLine();
        }
    }
}
vote_ok
von DavidDev024 (250 Punkte) - 20.04.2020 um 16:52 Uhr
Quellcode ausblenden C#-Code
using System;

namespace Einmaleins
{
    class Program
    {
        static void Main(string[] args)
        {
            for (int i = 1; i <= 10; i++)
            {
                Console.Write(i + "\t");
                for (int k = 1; k <= 10; k++)
                {
                    Console.Write(i * k + "\t");
                }

                Console.WriteLine();
            }

            Console.ReadKey();
        }
    }
}
vote_ok
von Waldgeist (2310 Punkte) - 21.04.2020 um 10:50 Uhr
Mein Lösungsvorschlag:

Quellcode ausblenden C#-Code
using System;

namespace Aufgabe_301
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hallo!,\n Dieses Programm gibt die Zahlen des kleinen Einmaleins aus! \n\n" );

            for (int i = 1; i <= 10; i++)
            {
                for (int j = 1; j <=10 ; j++)
                {
                    Console.Write(i * j+"  ");
                }
                Console.WriteLine();
            }
            Console.ReadKey();
        }
    }
}
vote_ok
von Hermes_DE (80 Punkte) - 21.04.2020 um 15:34 Uhr
Quellcode ausblenden C#-Code
using System;

namespace DasKleineEinMalEins
{
    class Program
    {
        static void Main(string[] args)
        {
            int reihe;
            for (reihe = 1; reihe <= 10; reihe++)
            {
                for (int i = 1; i <= 10; i++)
                {
                    Console.Write(i * reihe + " ");
                }
                Console.WriteLine();
            }
        }
    }
}
vote_ok
von Phplppp (20 Punkte) - 28.05.2020 um 17:08 Uhr
Quellcode ausblenden C#-Code
using System;

namespace kleines_1Mal1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.Blue;
            Console.WriteLine("\n ---------- Das kleine 1 Mal 1 ----------\n");
            Console.ForegroundColor = ConsoleColor.White;
            for (int a = 1; a < 11; a++)
            {
                for (int x = 1; x < 11; x++)
                {   
                    Console.Write(x * a + "  ");

                }
                Console.WriteLine();
            }


        }
    }
}
vote_ok
von Kate (400 Punkte) - 09.07.2020 um 13:34 Uhr
Quellcode ausblenden C#-Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Einmaleins
{
    class Program
    {
        static void Main(string[] args)
        {
            int i, k;
            
            for (i = 1; i <= 10; i++)
            {
                for (k = 1; k < 11; k++)
                {
                    Console.Write(i * k + " ");
                }
            }
            Console.Read();
        }
    }
}
vote_ok
von Kate (400 Punkte) - 09.07.2020 um 13:36 Uhr
Ich hab die Form und die Ausgabe ein bisschen verändert:
Quellcode ausblenden C#-Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Einmaleins
{
    class Program
    {
        static void Main(string[] args)
        {
            int i, k;
            Console.WriteLine($"  1\t  2\t  3\t  4\t  5\t  6\t  7\t  8\t  9\t  10");
            for (i = 1; i <= 10; i++)
            {
                for (k = 1; k < 11; k++)
                {
                    Console.Write($"{k}*{i}={i * k}\t");
                }
                Console.WriteLine("");
            }
            Console.Read();

        }
    }
}
vote_ok
von Overmeier (120 Punkte) - 05.01.2021 um 13:46 Uhr
Quellcode ausblenden C#-Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Übungen_Aufgaben_zu_301
{
    class Program
    {
        static void Main(string[] args)
        {
            int G, k;


            for (G = 1; G <= 10; G++)

            {
                for (k = 1; k < 11; k++)
                {

                    Console.WriteLine(" Das Ergebnis ist = " + G * k );
                }

                Console.Read();
            }
        }
    }
}