Solutions of Practice Questions Exercises | Basics.
Here, is the solution of Practice question exercises Click here for question
Question No. 01.
CODE:
namespace ConsoleApp210
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Input Number");
int num = Convert.ToInt32(Console.ReadLine());
int b = 0;
int c;
while(num>0)
{
b+= num % 10;
num = num / 10;
}
Console.WriteLine("The sum of Digits are : {0}",b);
}
}
}
OUTPUT:
Question No. 02:
CODE:
namespace ConsoleApp210
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Input Number");
int num = Convert.ToInt32(Console.ReadLine());
int b = 0;
int c;
Console.Write("The reverse number is : ");
while(num>0)
{
b= num % 10;
num = num / 10;
Console.Write(b);
}
Console.WriteLine();
}
}
}
OUTPUT:
Question No. 03:
CODE:
namespace ConsoleApp210
{
class Program
{
static void Main(string[] args)
{
Console.Write("Input base :");
double Base = Convert.ToInt32(Console.ReadLine());
Console.Write("Input height : ");
double height = Convert.ToInt32(Console.ReadLine());
double area;
area = (height * Base) / 2;
Console.WriteLine("Area : {0}",area);
}
}
}
Question No. 04 :
CODE:
namespace ConsoleApp210
{
class Program
{
static void Main(string[] args)
{
double a = -1 + (4 * 6);
double b = (35 + 5) % 7 ;
double c = 14 + (-4) * (6 / 11);
double d = 2 + (5 / 6) * (1) - (7 % 2);
Console.WriteLine("-1 + (4 * 6)= {0}",a);
Console.WriteLine("(35 + 5) % 7= {0}", b);
Console.WriteLine("14 + (-4) * (6 / 11)= {0}", c);
Console.WriteLine("2 + (5 / 6) * (1) - (7 % 2)= {0}", d);
}
}
}
Question No. 01.
CODE:
namespace ConsoleApp210
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Input Number");
int num = Convert.ToInt32(Console.ReadLine());
int b = 0;
int c;
while(num>0)
{
b+= num % 10;
num = num / 10;
}
Console.WriteLine("The sum of Digits are : {0}",b);
}
}
}
OUTPUT:
Question No. 02:
CODE:
namespace ConsoleApp210
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Input Number");
int num = Convert.ToInt32(Console.ReadLine());
int b = 0;
int c;
Console.Write("The reverse number is : ");
while(num>0)
{
b= num % 10;
num = num / 10;
Console.Write(b);
}
Console.WriteLine();
}
}
}
OUTPUT:
Question No. 03:
CODE:
namespace ConsoleApp210
{
class Program
{
static void Main(string[] args)
{
Console.Write("Input base :");
double Base = Convert.ToInt32(Console.ReadLine());
Console.Write("Input height : ");
double height = Convert.ToInt32(Console.ReadLine());
double area;
area = (height * Base) / 2;
Console.WriteLine("Area : {0}",area);
}
}
}
OUTPUT:
Question No. 04 :
CODE:
namespace ConsoleApp210
{
class Program
{
static void Main(string[] args)
{
double a = -1 + (4 * 6);
double b = (35 + 5) % 7 ;
double c = 14 + (-4) * (6 / 11);
double d = 2 + (5 / 6) * (1) - (7 % 2);
Console.WriteLine("-1 + (4 * 6)= {0}",a);
Console.WriteLine("(35 + 5) % 7= {0}", b);
Console.WriteLine("14 + (-4) * (6 / 11)= {0}", c);
Console.WriteLine("2 + (5 / 6) * (1) - (7 % 2)= {0}", d);
}
}
}
OUTPUT:
Question No. 5:
CODE:
namespace ConsoleApp210
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Input the value of angle");
double angle = Convert.ToDouble(Console.ReadLine());
double rad = angle * (Math.PI / 180);
double sin = Math.Sin(rad);
double cos = Math.Cos(rad);
double tan = Math.Tan(rad);
double tanInverse = Math.Tanh(rad);
double sinInverse = Math.Sinh(rad);
double cosInverse = Math.Cosh(rad);
Console.WriteLine("Sin : {0}",sin);
Console.WriteLine("cos : {0}", cos);
Console.WriteLine("tan : {0}", tan);
Console.WriteLine("tan inverse : {0}", tanInverse);
Console.WriteLine("sin inverse : {0}",sinInverse );
Console.WriteLine("cos inverse : {0}", cosInverse);
}
}
}
OUTPUT:
Question No. 06 :
CODE:
amespace ConsoleApp210
{
class Program
{
static void Main(string[] args)
{
Console.Write("Enter Value C: ");
string C = Console.ReadLine();
Console.Write("Enter Value D: ");
string D = Console.ReadLine();
string temp;
temp = C;
C = D;
D = temp;
Console.WriteLine("New Value of C: {0}",C);
Console.WriteLine("New Value of D: {0}", D);
}
}
}
OUTPUT:
Question No. 7;
CODE:
namespace ConsoleApp210
{
class Program
{
static void Main(string[] args)
{
Console.Write("Enter Number: ");
int num = Convert.ToInt32(Console.ReadLine());
int a = num * 1;
int b = num * 1;
int c = num * 1;
int d = num * 1;
int e = num * 1;
int f = num * 1;
int g = num * 1;
int i = num * 1;
int h = num * 1;
int j = num * 1;
Console.WriteLine("{0} x 1 = {1}",num,a);
Console.WriteLine("{0} x 2 = {1}", num, b);
Console.WriteLine("{0} x 3 = {1}", num, c);
Console.WriteLine("{0} x 4 = {1}", num, d);
Console.WriteLine("{0} x 5 = {1}", num, e);
Console.WriteLine("{0} x 6 = {1}", num, f);
Console.WriteLine("{0} x 7 = {1}", num, g);
Console.WriteLine("{0} x 8 = {1}", num, h);
Console.WriteLine("{0} x 9 = {1}", num, i);
Console.WriteLine("{0} x 10 = {1}", num, j);
}
}
}
OUTPUT:
More Question Updated Soon:
Solutions of Practice Questions Exercises | Basics.
Reviewed by Developer Planet
on
November 01, 2018
Rating:
No comments: