107 296
Assignments Done
97.7%
Successfully Done
In March 2023

# Answer to Question #243102 in C# for Gayatri

Question #243102

1. Write a C# Sharp program to print Hello and your name in a separate line.

2. Given a temperature in Celsius degrees, write a method that converts it to Fahrenheit degrees.

3. Given two integers, write a method that swaps them using temporary variable.

4. Given an integer, write a method that checks if it is even.

5. Given a number, write a method that checks if it is positive, negative or zero.

6. Given a year as integer, write a method that checks if year is leap.

1
2021-10-01T07:45:52-0400
// 1
using System;

namespace ConsoleApplication1
{
internal class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello");
Console.WriteLine("Name");
}
}
}
// 2
using System;

namespace ConsoleApplication1
{
internal class Program
{
public static double CelsiusToFarenheit(double c)
{
return c * 9 / 5 + 32;
}
public static void Main(string[] args)
{
Console.WriteLine(CelsiusToFarenheit(10));
}
}
}
// 3
using System;

namespace ConsoleApplication1
{
internal class Program
{
public static void Main(string[] args)
{

int temp;

temp = num1;
num1 = num2;
num2 = temp;

Console.WriteLine(\$"{num1} {num2}");
}
}
}
// 4
using System;

namespace ConsoleApplication1
{
internal class Program
{
public static void Main(string[] args)
{

if (num % 2 == 0)
Console.WriteLine("Even");
else
Console.WriteLine("Odd");
}
}
}
// 5
using System;

namespace ConsoleApplication1
{
internal class Program
{
public static void Main(string[] args)
{

if (num > 0)
Console.WriteLine("Positive");
else if (num < 0)
Console.WriteLine("Negative");
else
Console.WriteLine("Zero");
}
}
}
// 6
using System;

namespace ConsoleApplication1
{
internal class Program
{
public static void Main(string[] args)
{

if (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0))
Console.WriteLine("Leap");
else
Console.WriteLine("not leap");
}
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!