HomeWork No. 1.docx - Bahria University Lahore Campus Department of Computer Sciences COMPUTER PROGRAMMING HOMEWORK 01 Instructor Name Mr Zia Ul Rehman

HomeWork No. 1.docx - Bahria University Lahore Campus...

This preview shows page 1 - 2 out of 5 pages.

C OMPUTER P ROGRAMMING H OME W ORK # 01 Instructor Name: Mr. Zia Ul Rehman Program: BSIT Simple flow control : 1. Write a program to print Hello Message. 2. Write a program to print first five natural numbers. 3. Write a program to print 5 * using cout. 4. Write a program that takes two integer values from user and displays their sum. 5. Write a program that takes radius of a circle from user as input and then calculates area of the circle using formulae a. Area = PI * R * R where R is radius of circle. And PI is a constant defined in the program. 6. Write a program that takes temperature in Fahrenheit and converts it into centigrade using following formulae. C = 5 * (F – 32 ) / 9 Where C is centigrade and F is for Fahrenheit. Use of IF : 7. Write a program to take an input, if number is odd then program should print message “Odd number.” And if number is even then program should print “even number”. (Hint : Use Modulus Operator) 8. (Repeat this question with if and switch both) Write a Program that takes
Image of page 1
Image of page 2

You've reached the end of your free preview.

Want to read all 5 pages?

  • Fall '18
  • Zia Ul Rehman
  • Fahrenheit, Carriage return, Bahria University, Department of Computer Sciences, Mr. Zia Ul Rehman

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture