lab4 - and Blue (RGB) values given by a user. Colour Red...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
ECC 3101- Computer Programming Lab Sheet 4 – switch statement 1. Rewrite the previous program- Lab 3, Question 1 , using the switch case statement. 2. Write a program that implements a simple calculator that reads 2 integers and math operator ('+', '-', '*', '/', '%') from the keyboard , print the answer and exit. Eg. output is as follows: 7 + 6 = 13 7 – 6 = 1 7 * 6 = 42 7 / 6 = 1.667 7 % 6 = 1 3. Write a program using switch statement to recognize a colour based on the value of Red, Green
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: and Blue (RGB) values given by a user. Colour Red Green Blue Black White 255 255 255 Red 255 Green 255 Blue 255 Yellow 255 255 4. Write a program that reads in two integers and determines and prints whether it is odd or even. [Hint: Use the modulus operator. An even number is a multiple of two. Any multiple of two leaves a remainder of zero when divided by 2.]...
View Full Document

This note was uploaded on 10/17/2008 for the course ECC 3102 taught by Professor Burney during the Spring '08 term at Punjab Engineering College.

Ask a homework question - tutors are online