Coding

Below, I will show you some C# coding. I was asked to structure my own set of coding on an online coding editor. This editor is called “IDEONE”. The purpose of this task will show you how C# coding is structured. I was given 9 coding tasks to complete. I will display them below as I go along.

Task 1: Write a C# programme that displays your name on one line. Copy the code in this image into IDEONE and run the code.

The screenshots for each of my tasks will be my completed work for each of them.

Task 2: Write a C# Sharp program to print the sum of two numbers.

Task 3: Write a C# Sharp program to print the result of dividing two numbers.

Task 4: Write a C# Sharp program to print the result of the specified operations.

Task 5: Write a C# code that remembers a whole number known as an integer, int for short.

Task 6: Write a C# code that uses 2 numbers for a sum and formats output onto the screen.

Task 7: Write a C# code that gets numbers from the keyboard.

Task 8: Write a C# Sharp program to print on screen the output of adding, subtracting, multiplying and dividing of two numbers which will be entered by the user.

Task 9: Write a C# Sharp program that takes an age (for example 20) as input and prints something as “You look older than 20”.

Decisions

For this task, I was given a 2-parter task on displaying C# code on Ideone to demonstrate how to your print age and name on screen. in multiple ways. Those ways will be demonstrated with screenshots of my completed tasks.

Task 1: Write C# code that prints your name and age on the screen.

Task 2: Write C# code that prints your name and age on the screen using an int and a string.

Task 3: Write C# code that gets user input for age and name, prints your name and age on the screen using an int and a string (NOTE: you must use the input tab anywhere you have a ReadLine).

Task 4: Write C# code that gets user input for age and decides if you are 18 (NOTE: you must use the input tab).

Task 5: Change the value of yourAge in task 4 above to 10 and run it. What is the output? Change the value of yourAge again to 33. What is the output?

yourAge input – 10:

yourAge input – 33:

Task 6: Write C# code that gets user input for age and decides if you are 18 or over. Test this code with input of 10, then 18 and finally 33.

Task 7: Write C# code that gets user input for age and decides if you are 18 or under. Test this code with input of 10, then 18 and finally 33.

Task 8: Change the test in the line of code if(yourAge<=18) in the code for task 7. Try running it with the following: “<, >, !=

code: “>”

This image has an empty alt attribute; its file name is image-11.png

code: “<“

This image has an empty alt attribute; its file name is image-12.png

code: “!=”

Task 9: Change the value of the test from task 7 code from 18 to another number, try 10, 16, 19 and 33. What is happening and why?

10

16

19

33