Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Assignment c++12
1. Assignment No.1
Submitted To: Adnan Nawaz
Submitted By: Syed Muhammad Umair
Subject: Programming &Problem Solving
Department: Computer Science
Semester: 2nd
Roll No. 12
Indus International Institute D.G.Khan
2. /*Write a program that generates the following output using a single nested loop
$
##
$$$
#### */
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
inti,j;
for(i=1;i<=4;i++)
{
for(j=1;j<=i;j++)
if(i%2==0)
cout<<"#";
else
cout<<"$";
cout<<"n";
}
getch();}
Output:
4. /*Write a program that input two number interchange the value of and then display them without
using third variable.*/
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
inta,b;
cout<<"Entr 1st num : ";
cin>>a;
cout<<"Entr 2nd num : ";
cin>>b;
cout<<"Value Befor Swapping:"<<endl;
cout<<"1st num="<<a<<endl;
cout<<"2nd num="<<b<<endl;
a=a+b;
b=a-b;
a=a-b;
cout<<"Value After Swapping:"<<endl;
cout<<"1st num="<<a<<endl;
cout<<"2nd num="<<b<<endl;
getch();}
Output: