[SOLVED] IT1010 Lab Sheet 11

30.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon Lab-Sheet-11-clmevr.zip (556.8 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
🔒 Securely Powered by:
Secure Checkout
Rate this product

Exercise 1

The factorial of a nonnegative integer n is written n! and is defined as follows:  n! =  n * (n – 1) * (n – 2) * ……1  and

n! = 1 (for n = 0)

For example, 5! = 5 * 4 * 3 * 2 * 1, which is 120

 

Write a C program that reads a nonnegative integer and computes and print its factorial using a while loop.

Exercise 2

A company pays its employees a salary between $200 to $1500. Write a C program (using arrays of counters) that determine how many of the employees earned salaries in each of the following ranges ( assume that each employee’s salary is truncated to an integer amount). The program should stop entering the salaries, when the user input -1 a salary.

 

  1. $200 – $299
  2. $300 – $399
  3. $400 – $499
  4. $500 – $599
  5. $600 – $699
  6. $700 – $799
  7. $800 – $899
  8. $900 – $999
  9. 1000 and above

 

Exercise 3

 

Write a C program to multiply the content of array A and B and store it in a new array called C.

 

int A[5] = { 10, 20, 30, 40, 50};

int B[5] = { 34, 67, 12, 89, 12};

 

Exercise 4

 

Write a C program that will enter a name, store it in an array and then display it backwards. Allow the length of the line to be unspecified (terminated by pressing the Enter key). , but assume that it will not exceed 20 characters.

Exercise 5

 

Implement a function called convertToUpperCase ( ) which take a string (a mix of uppercase and lower case letters) as an argument and display the string in only upper case letters.

 

void  convertToUpperCase (char a[ ], int size );

 

In your main function declare a character array called address and copy the address “SLIIT, New Kandy Road, Malabe” using string copy function. Pass the address to the  convertToUpperCase ( ) function and display the address in capital letters.

 

Hint : ‘a’ – 97, ‘z’ –  122, ‘A’ – 65, ‘Z’ – 90

 

  • Lab-Sheet-11-clmevr.zip