0% found this document useful (0 votes)
5 views

Assignment 5

Uploaded by

f24604020
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Assignment 5

Uploaded by

f24604020
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

National University of Technology

Name: M.Shah Zaman

ID: F24604020
Subject: CEW

Submitted To: Lec. Iqra Ashraf

Date: 10/11/2024
Objective:
 To understand the basics of C programming.
 To get familiar with Conditional statement.

Software/Tools:
 Dev C++
 Tutorialspoint.com

Theoretical Explanation:
In this particular lab we’re going to have a basic understanding of how the
Application ‘C++’ works. We’re going to get a grasp of the environment we’re
going to perform on, furthermore we’re going to learn about loops and conditional
statements which will enhance our ability to use the C language.

Lab Tasks

Question 1(a):
Design a calculator in C that can perform the following binary operations on two
numbers obtained from user. The choice of operation should also be available to the user.
1. Addition
2. Subtraction
3. Multiplication
4. Division

Code (Part 1):


Code (Part 2):

Result:

Question 2(a):
Modify your design of the calculator such that it won’t terminate after just one execution but
instead asks from the user to enter a specific key to terminate. Otherwise, your calculator
should keep on asking for the new numbers and operation.

Result Of the Code:


Code:

END OF Q(a)
Question 1(b):
Write a program in C to display n terms of natural number and their sum.

Code:

Result:
Question 2(b):
Write a Program to add numbers until the user enters zero. (Hint: Use do while)

Code:

Result:

END OF Q(b)

You might also like