Number and Program

Only available on StudyMode
  • Download(s) : 64
  • Published : October 25, 2012
Open Document
Text Preview
NATIONAL UNIVERSITY OF COMPUTER & EMERGING SCIENCES
INTRODUCTION TO COMPUTING (CS 101) - FALL 2012 ASSIGNMENT # 1 Due Date: October 30, 2012 (11:55 pm) Submission: The assignment has to be submitted via slate. You must submit only source code files with proper naming convention. For example, (Question No. 1 of Assignment No. 1) should be named as A1Q1.c, question No. 2 of Assignment No. 3) should be named as A3Q2.c, etc. Make a folder, name it as (For e.g. 11K-2122_Sec(A)), place the source files for all the problems in this folder. The compressed folder should be submitted to slate. The program should be properly commented. Add your name and roll number at the beginning of each program, in comments. Plagiarism: Any sort of plagiarism is not allowed. If found plagiarized it will be graded 0 marks. __________________________________________________________________________________________

Q.1: Write a program that lets the user perform arithmetic operations on two numbers (integers). Your program must be menu driven, allowing the user to select the operation (+, -, *, or /) and input the numbers. Furthermore, your program must consist of following functions: A) Function showChoice: This function shows the options to the user and explains how to enter data. B) Function add: This function accepts two numbers (integers) as arguments and returns sum. C) Function subtract: This function accepts two numbers (integers) as arguments and returns their difference. D) Function multiply: This function accepts two numbers (integers) as arguments and returns product. E) Function divide: This function accepts two numbers (integers) as arguments and returns quotient (double).

Q2: Write a program to take a depth (in kilometers) inside the earth as input data; compute and display the temperature at this depth in degrees Celsius and degrees Fahrenheit. The relevant formulas are: Celsius = 10(depth) +20 Fahrenheit = 1.8(Celsius) +32 Include two functions in your program....
tracking img