Write A C

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

1.

Write a C# program that takes three letters as input and display them in reverse
order.
2. Write a C# program that takes 2 inputs form user respectively name and
surname, and then print it as "NAME SURNAME" (both uppercase) in console
3. Write a C# program that takes the radius of a circle as input and calculate the
perimeter and area of the circle and print it in console
4. Make a lot of exercises with different types and try to understand important
aspects

1. Write a C# program that takes two numbers as input and returns true or false
when both numbers are even or odd
2. Write a C# program which takes 2 string input from user and return if second
string is in first string. Example. 1st input: Azərbaycan, 2nd input: can, Result
should be true because can is in Azərbaycan
3. Get 2 int number input from user and calculate the exact input1 / input2.
Example: 16, 5. Result should be 3.2 not 3.
4. Practise type conversions (different options), types and operators

1. Write a C# that calculates the day of week (ex: Monday) of your birthday
2. Write a C# that calculates you current life days (how many days past since your
birth)
3. Write a C# program to calculate what day of the week is after 40 days from this
moment
4. Write a program in C# to check whether the given year, month and day are the
current or not. Test Data :
Input the Day : 17
Input the Month : 09
Input the Year : 2016
Expected Output :

The formatted Date is : 17/09/2016 The current date status : True

5. Write a program in C# to get the day of week from last day of the current year
against a given date. Test Data:
Input the Day : 12
Input the Month : 12
Input the Year : 2012
Expected Output :
The formatted Date is : 12/12/2012
The Last day of the year 2012 is : 31/12/2012

6. Write a program in C# Sharp to find the last day of a week against a given date.
Test Data:
Input the Day : 16
Input the Month : 06
Input the Year : 2016
Expected Output :

The formatted Date is : 16/06/2016 The last day of the week for the above date is:
18/06/2016

7. Write a C# Sharp program to find the largest of three numbers. Test Data :
Input the 1st number :25
Input the 2nd number :63
Input the 3rd number :10
Expected Output :
The 2nd Number is the greatest among three

8. Write a program in C# Sharp to read any day number in integer and display day
name in the word. Test Data : 4 Expected Output : Thursday

9. Write a program in C# Sharp which is a Menu-Driven Program to perform a


simple calculation.

Test Date and Expected Output


Enter the first Integer :10
Enter the second Integer :2

Here are the options :


1-Addition.
2-Substraction.
3-Multiplication.
4-Division.
5-Exit.

Input your choice :3


The Multiplication of 10 and 2 is: 20

1. Write a program in C# to display the first 10 natural numbers


2. Write a C# program to find the sum of first 20 odd natural numbers.
3. Write a program in C# to read 5 numbers from keyboard and find their sum and
average.
4. Write a program in C# to display the multiplication table vertically from 1 to n.
Test Data:
Input upto the table number starting from 1 : 8
Expected Output:
Multiplication table from 1 to 8
1x1 = 1, 2x1 = 2, 3x1 = 3, 4x1 = 4, 5x1 = 5, 6x1 = 6, 7x1 = 7, 8x1 = 8
...
1x10 = 10, 2x10 = 20, 3x10 = 30, 4x10 = 40, 5x10 = 50, 6x10 = 60, 7x10 = 70,
8x10 = 80
5. Write a program in C# to display the pattern like right angle triangle using an
asterisk. The pattern like :

*
**
***
****
*****

6. Write a program in C# to make such a pattern like right angle triangle with
number increased by 1. The pattern like :
1
23
456
7 8 9 10
7. Write a program in C# to display the sum of the series [ 9 + 99 + 999 + 9999 ...].
Test Data :
Input the number or terms :5
Expected Output :
9 99 999 9999 99999
The sum of the series = 111105
8. Write a C# program to find prime numbers up to users entered value.
Exmpl: input-100, Result: 2, 3, 5, 7, 11, 13 ... 89, 97
9. Write a program in C# to check whether a number can be express as sum of two
prime numbers.
Test Data :
Input a positive integer: 16
Expected Output :
16 = 3 + 13
16 = 5 + 11
10. Write a program in C# to check whether a number is a palindrome (visual
simmetric) or not. Test Data :
Input a number: 121
Expected Output :
121 is a palindrome number.

Enter the value between 10 and 100. Initialize int array with random values with length
of user entered value. Do following tasks

1. Write a program in C# sort array both descending and ascending order


2. Write a C# program to find the 3rd max element of array.
3. Write a program in C# to find first 4 max elements.

Other tasks - Write seperate method for each task and call them
in Main method
4. Write a program in C# to create a function to swap the values of two integer
numbers without additional variable. Test Data : Enter a number: 5 Enter another
number: 6 Expected Output : Now the 1st number is : 6 , and the 2nd number is :
5

5. Write a program in C# to create a function to display the n number Fibonacci


sequence. Test Data : Input number of Fibonacci Series : 5 Expected Output : The
Fibonacci series of 5 numbers is : 0 1 1 2 3 5 8

6. Write a program in C# to create a function to calculate the sum of the individual


digits of a given number. Test Data : Enter a number: 1234 Expected Output : The
sum of the digits of the number 1234 is : 10

7. Write a program in C# Sharp to create a function to input a string and count


number of spaces are in the string. Test Data : Please input a string : This is a test
string. Expected Output : "This is a test string." contains 4 spaces

8. https://www.hackerrank.com/ - Create an account and get ready for next lesson,


we are going to do some online coding next lesson

1. https://www.hackerrank.com/challenges/mini-max-sum/problem
2. https://www.hackerrank.com/challenges/plus-minus/problem
3. https://www.hackerrank.com/challenges/birthday-cake-candles/problem
4. https://www.hackerrank.com/challenges/time-conversion/problem
5. https://www.hackerrank.com/challenges/staircase/problem
6. https://www.hackerrank.com/challenges/day-of-the-programmer/problem

1. https://www.hackerrank.com/challenges/divisible-sum-pairs/problem
2. https://www.hackerrank.com/challenges/kangaroo/problem
3. https://www.hackerrank.com/challenges/sock-merchant/problem

1. https://www.exercisescsharp.com/oop/first-class-method-tostring
2. https://www.exercisescsharp.com/oop/constructors-destructors
3. https://www.exercisescsharp.com/oop/class-person-student-and-teacher
4. https://www.exercisescsharp.com/oop/photo-book-class
5. https://www.exercisescsharp.com/oop/inheritance-of-objects

1. https://www.exercisescsharp.com/oop/shapes-class-diagram - After creating


correct classes create ab array of different SHAPES and calculate both perimeter
and area

2. Create a SchoolPerson class that has SchoolName, Name, Surname, Age and
DateOfBirth, CurrentClass properties. Also this class will have a general Greet
method, which will show us "Hello {Name Surname}".

Create a class "Student" and another class "Teacher", both descendants of


"SchoolPerson" class. "SchoolPerson" will have a method calles "GoToClasses"
and when calling this method it will show us "Inside Base GoToClasses method"

The class "Student" will also have a public method "GoToClasses", which will write
on screen "I’m {name surname}, I am student and I'm going to class."

The class "Teacher" will have a public method "Explain", which will show on
screen "Explanation begin on subject {subject}". Also, it will have a private
attribute "subject", a string which indicates his/her speciality. Also "Teacher" will
have a public method "GoToClasses", which will write on screen "I’m {name
surname}, I am a teacher."

The class SchoolPerson must have a functionality to set of their age (eg, 20 years
old). Note: Age cannot be less than 6 and more than 50. If we try to assign invalid
number exception should be thrown.

The student will have a public method "ShowAge" which will write on the screen
"My age is: 20 years old" (or the corresponding number).
You must create another test class called "StudentAndTeacherTest" that will
contain "Main" and:
Create a SchoolPerson and make it say hello
Create a student, set his age to 21, tell him to Greet, display his age and make
him to go classes
Create a teacher, set age to 30 years old, ask him to say hello, then go to classes
and then explain.

https://apipheny.io/free-api/ - Implement 4,6,7,9 APIs

1. Organize contents of any directory and it's files in the following style \

o All image files should be in Images folder (png, jpg and etc.)
o All video files should be in Videos folder (.mp4 and etc.)
o All pdf and office files should be in Documents folder
o All other files should in Other Files folder
o Remove any empty directory

2. Write a program in C# Sharp to create and read the last line of a file.
Test Data:
Input number of lines to write in the file :3
Input 3 strings below :
Input line 1 : line1
Input line 2 : line2
Input line 3 : line3

Expected Output:

The content of the last line of the file mytest.txt is: line3

3. Write a program to calculate all files and directories count in a given directory
(including files and folder in any subdirectory)

4. Create a C# program that implements an IVehicle interface with two methods,


one for Drive of type void and another for Refuel of type bool that has a
parameter of type integer with the amount of gasoline to refuel. \ Then create
a Car class with a builder that receives a parameter with the car's starting
gasoline amount and implements the Drive and Refuel methods of the IVehicle.
The Drive method will print on the screen that the car is Driving, if the gasoline is
greater than 0. The Refuel method will increase the gasoline of the car and return
true. To carry out the tests, create an object of type Car with 0 of gasoline in
the Main of the program and ask the user for an amount of gasoline to refuel,
finally execute the Drive method of the car.
Input
50
Output
Driving

1. We need to show how many drives we have currently (C, D and etc), also for each
one show total size, available size and used size (in MB)
2. Show size of RAM and current usage (how many MB is in use now)
3. Show current CPU usage in percentage
4. Write a program to shut down the computer after predefined value. For example
get an input from user (example: 5 minutes) and after 5 minutes computer should
be shut down

You might also like