Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

COMSATS UNIVERSITY ISLAMABAD,

WAH CAMPUS

                  Programming fundamentals

ASSIGNMENT # 02

 Submitted To: MAM RAMSHAH AHMED


 Submitted By:  IQRA ZAINAB
 Roll#:  SP21-BSE-079(B2)
LAB# 2

Question#01
Print Diamond using escape sequence “\n” and “\t”? In single cout
statement?
Output should be like
*
* * *
* * * * *
* * *
*

Question #02
Print your Result Card using required escape sequences? Print all other
information as it is but get input from user in obtained marks and calculate
the percentage of entered marks?
Output:
Result Card
Name: ABC Reg. #: CIIT/---------
Session: Fall-16 Semester: 2
Subjects Total Marks Obtained
Marks
Digital Logic Design 100 ___user
input___
Electronics-I 100 ___user
input___
English 100 ___user input___

Percentage= %

Question#03
Develop a C++ program that declare almost 6 types of identifiers and
display their sizes in bytes on the screen.
Question #04
Develop a C++ program that prints the table of 2 without using loop?

Question #5:
write a program to swap the value of a and b
let a=10 and b = 20
your output should be
a = 20 and b = 10
LAB# 3
Question # 1: Write a program to take two float numbers then find
remainder of them by using type casting in integer form.
Question # 2: Write a program to take input name, address and age from
user, then display data on screen.

Question # 3: Write a program to take input a character and display its


ASCII code.

Question # 4: Take an amount from user, interest rate and number of years
from user let suppose 1000, 5% and 3. Find Interest amount for those
years. (e.g. output for above values is 150)
Question # 5: Write a program to take dividend and divisor. Then display
the quotient and remainder.(e.g. 20 3. Quotient=6, Remainder=2)

Question # 6: Write a program to take input base and height of triangle.


Now calculate area by using formula Area=1/2 x base x height;.
Question # 7: Write a program to take temperature in Celsius and convert
it into Fahrenheit by using F=9/5 *C +32;.

Question # 8: Write a program to take three digit numbers from user then
display its reverse order.

You might also like