Posts

Showing posts from January 26, 2018

Computer Programming Lab 5

Lab 04: Loops Exercise 1: Write a C++ program to print the following pattern on the screen. Ask user to enter a integer value from 1 to 10. Use while loop. Source Code: #include <iostream> using namespace std; int main() {             int i,j,n;             cout<<"enter a integer value from 1 to 10: ";             cin>>n;             i=0;             while(n>=i)             {                         j=n;                ...

Computer Programming Lab 4

          Lab 03: Decision Statements Exercise 1: Write a C++ Program that read a float (amount) and an int (num) input from user. Add both (amount and num) numbers and store them in two different int (a) and float (b) variables. Display the outputs of a and b variables. Also if outputs are greater than 16 print “value of a & b > 16” else print “value of a & b < 16”. Source Code: #include <iostream> using namespace std; int main() {             float amount,b;             int num,a;                         cout<<"amount= ";             cin>>amount;             cout<<"num= "; ...