0% found this document useful (0 votes)
18 views

C# Sunday Task

Uploaded by

mailtoprakashdon
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

C# Sunday Task

Uploaded by

mailtoprakashdon
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

/*Question 1:

There was a large ground in center of the city which is rectangular in shape. The
Corporation decides to build a Football stadium in the area for school and college
students, But the area was used as a car parking zone. In order to protect the land
from using as an unauthorized parking zone , the corporation wanted to protect the
stadium by building a fence. In order to help the workers to build a fence, they
planned to place a thick rope around the ground. They wanted to buy only the exact
length of the rope that is needed. They also wanted to cover the entire ground with
a carpet during rainy season. They wanted to buy only the exact quantity of carpet
that is needed. They requested your help.Can you please help them by writing a
program to find the exact length of the rope and the exact quantity of carpet that
is required?

Answer :-
*/

using System;
public class first{
public static void Main(){
int a=int.Parse(Console.ReadLine());
int b=int.Parse(Console.ReadLine());
Console.WriteLine(2*(a+b));
Console.WriteLine(a*b);
}
}
/
*----------------------------------------------------------------------------------
--------------------------------------------*/

/*
Question 2:
Long ago , there was a war between the Romans and Greeks.The Roman and Greek armies
meet outside the walls of Florence. Seeing the bloodshed the two kings to decide to
end the battle as early as possible as both the armies suffer a lot.
The shape of the battle ground is Square. To win the war is to conquer the flag
first by the opposite army , it has been decided to place the flag post at the
exact center of the battle field. Can you please help them in placing the flag post
at the exact center? Given the coordinates of the left bottom vertex of the square
ground and the length of the side of the battle field, you need to write a program
to determine the coordinates of the centre of the ground.

Answer :-
*/

using System;
public class second{
public static void Main(){
int a=int.Parse(Console.ReadLine());
int b=int.Parse(Console.ReadLine());
int length=int.Parse(Console.ReadLine());
Console.WriteLine(((length/2)+a)+" "+((length/2)+b));
}
}
/
*----------------------------------------------------------------------------------
--------------------------------------------*/
/*
Question 3:
3 Idiots

Ajay, Binoy and Chandru were very close friends at school. They were very good in
Mathematics and they were the pet students of Emily Mam. Their gang was known as 3-
idiots. Ajay, Binoy and Chandru live in the same locality.

A new student Dinesh joins their class and he wanted to be friends with them. He
asked Binoy about his house address. Binoy wanted to test Dinesh's mathematical
skills. Binoy told Dinesh that his house is at the midpoint of the line joining
Ajay's house and Chandru's house. Dinesh was puzzled. Can you help Dinesh out?
*/

using System;
public class third{
public static void Main(){
double x1=double.Parse(Console.ReadLine());
double y1=double.Parse(Console.ReadLine());
double x2=double.Parse(Console.ReadLine());
double y2=double.Parse(Console.ReadLine());
Console.WriteLine(((x1+x2)/2)+" "+((y1+y2)/2));
}
}
/
*----------------------------------------------------------------------------------
--------------------------------------------*/
/*
n=5 O/P:- 1 2 3 4 5
*/
using System;

public class HelloWorld


{
public static void Main(string[] args)
{
int num=int.Parse(Console.ReadLine());
for(int i=0;i<num;i++){
Console.Write(i+" ");
}
}
}
/
*----------------------------------------------------------------------------------
--------------------------------------------*/
/*
n=5 O/P:- 1 2 3 4 5 6 7
*/

using System;

public class HelloWorld


{
public static void Main(string[] args)
{
int num=int.Parse(Console.ReadLine());
for(int i=0;i<num+(num/2);i++){
Console.Write(i+1+" ");
}
}
}
/
*----------------------------------------------------------------------------------
--------------------------------------------*/
/*
n=5 O/P:- 0 2 4 6 8
*/

using System;

public class HelloWorld


{
public static void Main(string[] args)
{
int num=int.Parse(Console.ReadLine());
for(int i=0;i<num;i++){
Console.Write(i*2+" ");
}
}
}

/
*----------------------------------------------------------------------------------
--------------------------------------------*/
/*
n=5 O/P:- 1 3 5 7 9
*/

using System;

public class HelloWorld


{
public static void Main(string[] args)
{
int num=int.Parse(Console.ReadLine());
for(int i=0;i<num;i++){
Console.Write((i*2)+1+" ");
}
}
}

/
*----------------------------------------------------------------------------------
--------------------------------------------*/
/*
n=5 O/P:- 1 4 9 16 25
*/

using System;

public class HelloWorld


{
public static void Main(string[] args)
{
int num=int.Parse(Console.ReadLine());
for(int i=0;i<num;i++){
Console.Write((i+1)*(i+1)+" ");
}
}
}
/
*----------------------------------------------------------------------------------
--------------------------------------------*/
/*
n=5 O/P:- 5 10 15 20 25
*/

using System;

public class HelloWorld


{
public static void Main(string[] args)
{
int num=int.Parse(Console.ReadLine());
for(int i=0;i<num;i++){
Console.Write((i+1)*5+" ");
}
}
}

/
*----------------------------------------------------------------------------------
--------------------------------------------*/
/*
n=6 O/P:- 0 1 3 6 10 15
*/

using System;

public class HelloWorld


{
public static void Main(string[] args)
{
int num=int.Parse(Console.ReadLine());
int last_ans=0;
for(int i=0;i<num;i++){
last_ans=last_ans+i;
Console.Write(last_ans+" ");
}
}
}

/
*----------------------------------------------------------------------------------
--------------------------------------------*/
/*
n=6 O/P:- 0 5 15 30 50 75
*/

using System;

public class HelloWorld


{
public static void Main(string[] args)
{
int num=int.Parse(Console.ReadLine());
int last_ans=0;
for(int i=0;i<num;i++){
last_ans=last_ans+i;
Console.Write(last_ans*5+" ");
}
}
}

/
*----------------------------------------------------------------------------------
--------------------------------------------*/
/*
n=6 O/P:- 121 225 361 529 729
*/
using System;

public class HelloWorld


{
public static void Main(string[] args)
{
int num=int.Parse(Console.ReadLine());
int last_ans=11;
for(int i=0;i<num;i++){
Console.Write(last_ans*last_ans+" ");
last_ans+=4;
}
}
}

/
*----------------------------------------------------------------------------------
--------------------------------------------*/
/*
n=5 O/P:- 0 2 8 14 24
*/
using System;

public class HelloWorld


{
public static void Main(string[] args)
{
int num=int.Parse(Console.ReadLine());
for(int i=0;i<num;i++){
if(i%2==0)
Console.Write((i+1)*(i+1)-1+" ");
else
Console.Write((i+1)*(i+1)-2+" ");
}
}
}

/
*----------------------------------------------------------------------------------
--------------------------------------------*/

You might also like