Advertisement
GraionDilach

Fahrenheit -> Celsius

Oct 10th, 2011
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.31 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication3
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             int Fahrenheit = 0;
  13.  
  14.             Console.WriteLine("Whilelal:");
  15.             Console.WriteLine("Fahrenheit: \tCelsius:");
  16.  
  17.             while (Fahrenheit <= 300)
  18.             {
  19.  
  20.                 double Celsius = (double)((Fahrenheit - 32) * (5.0 / 9));
  21.                 //int Celsius = (int)((Fahrenheit - 32) * (5.0 / 9)); //Castolás.
  22.                 //C#-ban nincs automata tipuskonverzió kisebbre, kényszeríteni kell a konverziókat.
  23.                 //pl int a = (int)(5.5*66);
  24.                 //char b = (char)(a*(65*453.0));
  25.  
  26.                 Console.WriteLine("{0,10} \t {1,6:##0.00}", Fahrenheit, Celsius);
  27.                 //Kompozit formátum
  28.                 //printf C#-ban... persze ez is vacak. -_-
  29.                 //Inkább közelebb áll a BASIC PRINT USING-jához, tbh.
  30.  
  31.                 Fahrenheit += 20;
  32.  
  33.             }
  34.  
  35.  
  36.             Console.WriteLine("\nDo-whilelal:");
  37.  
  38.             Fahrenheit = 0;
  39.  
  40.             do
  41.             {
  42.  
  43.                 double Celsius = (double)((Fahrenheit - 32) * (5.0 / 9));
  44.                 //int Celsius = (int)((Fahrenheit - 32) * (5.0 / 9)); //Castolás.
  45.                 //C#-ban nincs automata tipuskonverzió kisebbre, kényszeríteni kell a konverziókat.
  46.                 //pl int a = (int)(5.5*66);
  47.                 //char b = (char)(a*(65*453.0));
  48.  
  49.                 Console.WriteLine("{0,10} \t {1,6:##0.00}", Fahrenheit, Celsius);
  50.                 Fahrenheit += 20;
  51.  
  52.             } while (Fahrenheit <= 300);
  53.  
  54.             Console.WriteLine("\nForral:");
  55.             for (Fahrenheit = 0; Fahrenheit <= 300; Fahrenheit += 20)
  56.             {
  57.                 double Celsius = (double)((Fahrenheit - 32) * (5.0 / 9));
  58.                 //int Celsius = (int)((Fahrenheit - 32) * (5.0 / 9)); //Castolás.
  59.                 //C#-ban nincs automata tipuskonverzió kisebbre, kényszeríteni kell a konverziókat.
  60.                 //pl int a = (int)(5.5*66);
  61.                 //char b = (char)(a*(65*453.0));
  62.  
  63.                 Console.WriteLine("{0,10} \t {1,6:##0.00}", Fahrenheit, Celsius);
  64.  
  65.             }
  66.  
  67.             Console.ReadKey();
  68.         }
  69.     }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement