
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

Computer Programming (Lab) (CS1121) Exercise 1 Instructor: Quratulain Siddiqui Note: create a new project and execute the following code, try to solve the errors yourself.
b. float main () { int a, b; cin<<a; float product; product= a*b; return product; }
c. void main () { bool 12xyz =false; if (12xyz==false) cout<<”the output is true” ;<< 12xyz; } d. void main() { float dim=0.1, dum=0.9; while ((dim+dum)==1) { count<<” DIM DUM”<< “\n” ;} }
Q2: what will be the output of the following programs? Explain steps in comments.
b. int main () { int X=8, Y=1,Z=0; While(Y!>10){ Z=X*Y; Y++; cout<<X<<” *”<<Y<<” =”<<Z; } return 0; }
c. void main (){ char alphabet=’b’; bool guess=false; if (alphabet ==’d’) {guess =true; } else {guess =false; } cout<< “Your Guess is ” << guess; } d. void main(){ char alpha=’y’; while(alpha!=’n’){ cout<<”in Loop aphla = ”<< alpha; cout<<”do you want to continue? (y/n)”; cin>>alpha; } cout<<”out of Loop alpha= ”<<alpha; }