Kirsiina

arvioitavaTehtava2

Oct 2nd, 2019
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.35 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace arvioitavaTehtava2
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.  
  14.             bool tahtirivi = true;
  15.             TulostaOtsikko(tahtirivi);
  16.  
  17.             Console.WriteLine("Anna lämpötila celsiusasteina: ");
  18.             int celsius = int.Parse(Console.ReadLine());
  19.             Console.WriteLine("Lämpötila on fahrenheiteina " + MuunnaLampotila(celsius));
  20.  
  21.             // MuunnaLampotila2(celsius); VAIHTOEHTOINEN, EI KÄYTÖSSÄ
  22.  
  23.             Console.ReadKey();
  24.         }
  25.  
  26.         public static void TulostaOtsikko(bool tahtirivi)
  27.         {
  28.  
  29.             Console.WriteLine("Celsius Fahrenheiteiksi");
  30.  
  31.             if (tahtirivi)
  32.             {
  33.                 Console.WriteLine("***********************");
  34.             }
  35.  
  36.         }
  37.        
  38.         public static int MuunnaLampotila(int celsius)
  39.         {
  40.             int fahrenheit = (celsius * 9) / 5 + 32;
  41.             return fahrenheit;
  42.  
  43.         }
  44.  
  45.         //public static void MuunnaLampotila2(int celsius)
  46.         //{
  47.         //    int fahrenheit = (celsius * 9) / 5 + 32;
  48.         //    Console.WriteLine("Lämpötila on fahrenheiteina " + fahrenheit);
  49.         //}
  50.         // VAIHTOEHTOINEN, EI KÄYTÖSSÄ
  51.  
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment