C# Code to Convert Temperature from degree Celcius to degree Fahrenheit
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Operators_A
{
class Program
{
static void Main(string[] args)
{
/*
* 1. Arithmetic Operators
* a. + (Addition)
* b. - (Subtraction)
* c. / (Division)
* d. * (Multiplication)
* e. % (Modulus, Remainder)
* f. ++ (Increment)
* g. -- (Decrement)
*/
//int a = 2000;
//int b = 302;
//Console.WriteLine("Sum is " + (a + b));
//Console.WriteLine("Subtraction of " + a + " and " + b + " is " + (a - b));
//Console.WriteLine("Division of " + a + " and " + b + " is " + (a / b));
//Console.WriteLine("Remainder of " + a + " and " + b + " is " + (a % b)); //188
//// Increment (Pre ++operand, Post operand++)
//Console.WriteLine(++a); // 2001
//Console.WriteLine(a); // 2001
Console.Write("Enter temperature in degree celcius: ");
float celcius = float.Parse(Console.ReadLine());
float fahrenheit = 1.8f * celcius + 32;
Console.WriteLine(celcius + " degree celcius is equals to " + fahrenheit + " fahrenheit");
Console.ReadKey();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Operators_A
{
class Program
{
static void Main(string[] args)
{
/*
* 1. Arithmetic Operators
* a. + (Addition)
* b. - (Subtraction)
* c. / (Division)
* d. * (Multiplication)
* e. % (Modulus, Remainder)
* f. ++ (Increment)
* g. -- (Decrement)
*/
//int a = 2000;
//int b = 302;
//Console.WriteLine("Sum is " + (a + b));
//Console.WriteLine("Subtraction of " + a + " and " + b + " is " + (a - b));
//Console.WriteLine("Division of " + a + " and " + b + " is " + (a / b));
//Console.WriteLine("Remainder of " + a + " and " + b + " is " + (a % b)); //188
//// Increment (Pre ++operand, Post operand++)
//Console.WriteLine(++a); // 2001
//Console.WriteLine(a); // 2001
Console.Write("Enter temperature in degree celcius: ");
float celcius = float.Parse(Console.ReadLine());
float fahrenheit = 1.8f * celcius + 32;
Console.WriteLine(celcius + " degree celcius is equals to " + fahrenheit + " fahrenheit");
Console.ReadKey();
}
}
}
Comments
Post a Comment
Post Your Valuable Comments