Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Kayttajan_syote
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Anna ensimmäinen luku");
- string kayttajansyote = Console.ReadLine();
- Console.WriteLine("Anna toinen luku");
- string kayttajansyote2 = Console.ReadLine();
- Console.WriteLine("Kerro haluatko summata luvut tai laskea lukujen erotuksen.");
- Console.WriteLine("Kirjoita plus tai miinus");
- string syote = Console.ReadLine();
- double summa = double.Parse(kayttajansyote) + double.Parse(kayttajansyote2);
- double erotus = double.Parse(kayttajansyote) - double.Parse(kayttajansyote2);
- if (syote == "plus")
- {
- if (summa >= 10)
- {
- Console.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine("Lukujesi summa on " + summa);
- } else
- {
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("Lukujesi summa on " + summa);
- }
- }
- if (syote == "miinus")
- {
- if (erotus >= 10)
- {
- Console.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine("Lukujen erotus on " + erotus);
- } else
- {
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("Lukujesi erotus on " + erotus);
- }
- }
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement