Assignment 5
Assignment 5
ID: F24604020
Subject: CEW
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
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.
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)