Docsity

CS1121 Computer Programming Lab Exercise 2, Exercises of Computer Engineering and Programming

Toggle sidebar
bg1
Mohammad Ali Jinnah University, Islamabad Campus
Computer Programming (Lab) (CS1121)
Exercise 2
Instructor: Quratulain Siddiqui
Note: create a new project and execute the following code, try to solve the errors
yourself.
Q1. Write a program that displays Multiplication table of any given input.
Q2. Write a program that takes a character as input and uses it for loop iteration. The loop must
continue its iteration if the character entered satisfies the loop condition.
Q2: what will be the output of the following programs? Explain steps in comments.
a. void main (){
bool istrue=false;
double d=9.1, c=0.9;
if((d+c)==1)
istrue=true;
else
istrue=false;
if(istrue==true)
{
cout<<”true/n”;
}
Else
cout<<”false/n”;
}
b. void main ()
{
Float X=8.6, Y=0.41,Z=0.08;
Z=X*Y;
}
return 0;
}
docsity.com

Partial preview of the text

Download CS1121 Computer Programming Lab Exercise 2 and more Exercises Computer Engineering and Programming in PDF only on Docsity!

Mohammad Ali Jinnah University, Islamabad Campus

Computer Programming (Lab) (CS1121) Exercise 2 Instructor: Quratulain Siddiqui Note: create a new project and execute the following code, try to solve the errors yourself.

Q1. Write a program that displays Multiplication table of any given input.

Q2. Write a program that takes a character as input and uses it for loop iteration. The loop must continue its iteration if the character entered satisfies the loop condition.

Q2: what will be the output of the following programs? Explain steps in comments.

a. void main (){

bool istrue=false;

double d=9.1, c=0.9;

if((d+c)==1)

istrue=true;

else

istrue=false;

if(istrue==true)

cout<<”true/n”;

Else

cout<<”false/n”;

b. void main () { Float X=8.6, Y=0.41,Z=0.08; Z=X*Y; } return 0; }

docsity.com