Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace kerto_teht
- {
- class Program
- {
- static void Main(string[] args)
- {
- int luku = 0;
- Console.WriteLine("luku -1 lopettaa loopin. \n\nAnna luku 1 - 20 väliltä");
- // lisätään 1 tyhjä väli selkeyttämisen kannalta
- Console.WriteLine();
- do
- {
- Console.WriteLine("Anna luku: ");
- luku = int.Parse(Console.ReadLine());
- if (luku >= 1 && luku <= 20)
- {
- for (int a = 1; a <= luku; a++)
- {
- for (int b = 1; b <= luku; b++)
- {
- Console.Write((a * b).ToString("00 "));//tulostetaan numeron kertotaulut
- }
- Console.WriteLine();
- }
- }
- if (luku < 1 || luku > 20)//poissuljetaan lukujen 1-20 ulkopuoliset luvut
- continue;
- else
- continue;
- }
- while (luku != -1);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement