Skip to content

phoesarah/Project1-NET041815

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Project1-NET041815

The first problem set for students in NET041815. The following exercises are extremely basic, but you will be asked to present your solutions as part of your weekly progress presentations. You are also expeced to have your GitHub account fully functional, and use your account to fork this repo. All answers should be pushed to a directory called FirstnameLastname in your version of this repository.

###Basic Flow-Control Exercises


Exercise CheckPassFail (if-else): Write a program called CheckPassFail which prints "PASS" if the int variable mark is more than or equal to 50; or prints "FAIL" otherwise.

Exercise PrintNumberInWord (nested-if, switch-case): Write a program called PrintNumberInWord which prints "ONE", "TWO",... , "NINE", "OTHER" if the int variable number is 1, 2,... , 9, or other, respectively. Use (a) a "nested-if" statement; (b) a "switch-case" statement.


###Loop Exercises

Exercise SumAndAverage (Loop): Write a program called SumAndAverage to produce the sum of 1, 2, 3, ..., to an upperbound (e.g., 100). Also compute and display the average. The output shall look like: The sum is 5050 The average is 50.5 TRY:

  1. Modify the program to use a "while" loop instead of "for" loop.
  2. Modify the program to sum from 111 to 8899, and compute the average. Introduce an int variable called count to count the numbers in the specified range.
  3. Modify the program to sum only the odd numbers from 1 to 100, and compute the average. (Hint: n is an odd number if n % 2 is not 0.)
  4. Modify the program to sum those numbers from 1 to 100 that is divisible by 7, and compute the average.
  5. Modify the program to find the "sum of the squares" of all the numbers from 1 to 100, i.e. 11 + 22 + 33 + ... + 100100.

Exercise CozaLozaWoza (Loop & Condition): Write a program called CozaLozaWoza which prints the numbers 1 to 110, 11 numbers per line. The program shall print "Coza" in place of the numbers which are multiples of 3, "Loza" for multiples of 5, "Woza" for multiples of 7, "CozaLoza" for multiples of 3 and 5, and so on. The output shall look like:

1 2 Coza 4 Loza Coza Woza 8 Coza Loza 11 
Coza 13 Woza CozaLoza 16 17 Coza 19 Loza CozaWoza 22 
23 Coza Loza 26 Coza Woza 29 CozaLoza 31 32 Coza

About

The first problem set for students in NET041815

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%