0% found this document useful (0 votes)
24 views13 pages

(Completed) Fundamentals of Programming Assingment

This document contains computer science student Moiz Ali Khan's responses to 5 programming assignment questions, providing code snippets and explanations for each question. The questions cover basic programming concepts like comparison operators, logical operators, user input/output, and calculating totals. Khan provides code and clear explanations for each question to demonstrate his understanding of fundamental programming concepts.

Uploaded by

Moiz Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views13 pages

(Completed) Fundamentals of Programming Assingment

This document contains computer science student Moiz Ali Khan's responses to 5 programming assignment questions, providing code snippets and explanations for each question. The questions cover basic programming concepts like comparison operators, logical operators, user input/output, and calculating totals. Khan provides code and clear explanations for each question to demonstrate his understanding of fundamental programming concepts.

Uploaded by

Moiz Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

Fundamentals Of Programming

Assignment 01
Department of Computer Science

From: Moiz Ali Khan


Roll No: B-21650
Section (A)

University Of South Asia

For: Sir Zeeshan Qaisar


Question No. 1:
a: Code & Output (Statement 1):

Explanation:
The code is simply asking us to compare 1 and i, In this case, i has been assigned value of 1
too. Therefore, we get output 1, which means the statement is true.
b: Code & Output (Statement 2):

c: Code & Output (Statement 3):


d: Code & Output (Statement 4):

Explanation:
Here were using the && operator, which means its a Logical AND operator. This requires both
statement p & q to be true. But since k < m is incorrect, the output is 0.
e: Code & Output (Statement 5):

Explanation:
In this statement we are using ||, or Logical OR operator. If, out of the given two statements,
even one of them is true, the program would give output of 1.

f: Code & Output (Statement 6):


g: Code and Output (Statement 7):

Explanation:
In this case were using !, or Logical NOT operator. What this does is, it basically reverses the
value of any given statement. For example, if we have 1 as value, itll become 0.

h: Code & Output (Statement 8):


i: Code & Output (Statement 9):
Question No. 2:

Explanation:
A simple programs that takes Radius as user input & returns value of Circumference, Area, and
Diameter.
Question No. 3:
Code:

Output:
Explanation:
A simple program that takes user input in the form of various values such as mileage, tax, tolls,
e.t.c. and returns value of user cost per day.

Question No. 4:
Code:
Output:

Explanation:
A simple programs that calculates the total sum of students Quizzes, Mid-Term & Finals results.
Question No. 5:
Code:

Output:
return 0;

You might also like