SlideShare a Scribd company logo
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
/*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:
/*Show 1st 8 FIBONACCI Number */
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
longint a=21,b=0,c=1,sum;
while(b<a)
{
cout<<c<<" ";
sum=b+c;
b=c;
c=sum;
}
getch();
}
Output:
/*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:

More Related Content

What's hot

Dti2143 lab sheet 9
Dti2143 lab sheet 9Dti2143 lab sheet 9
Dti2143 lab sheet 9
alish sha
 
اسلاید دوم جلسه پنجم کلاس پایتون برای هکرهای قانونی
اسلاید دوم جلسه پنجم کلاس پایتون برای هکرهای قانونیاسلاید دوم جلسه پنجم کلاس پایتون برای هکرهای قانونی
اسلاید دوم جلسه پنجم کلاس پایتون برای هکرهای قانونی
Mohammad Reza Kamalifard
 
Dynamic Program Problems
Dynamic Program ProblemsDynamic Program Problems
Dynamic Program Problems
Ranjit Sasmal
 

What's hot (20)

C++ programs
C++ programsC++ programs
C++ programs
 
Code quailty metrics demystified
Code quailty metrics demystifiedCode quailty metrics demystified
Code quailty metrics demystified
 
MFC Polygon
MFC PolygonMFC Polygon
MFC Polygon
 
1
11
1
 
HelsinkiOS Jan 2015: Useful iOS Code Snippets
HelsinkiOS Jan 2015: Useful iOS Code SnippetsHelsinkiOS Jan 2015: Useful iOS Code Snippets
HelsinkiOS Jan 2015: Useful iOS Code Snippets
 
Labsheet 5
Labsheet 5Labsheet 5
Labsheet 5
 
Dti2143 lab sheet 9
Dti2143 lab sheet 9Dti2143 lab sheet 9
Dti2143 lab sheet 9
 
Oops in c++
Oops in c++Oops in c++
Oops in c++
 
C++ programming example
C++ programming exampleC++ programming example
C++ programming example
 
Simple example program for inheritance in c++
Simple example program for inheritance in c++Simple example program for inheritance in c++
Simple example program for inheritance in c++
 
C++ assignment
C++ assignmentC++ assignment
C++ assignment
 
Code for program to draw a circle using mid point circle algorithm in c
Code for program to draw a circle using mid point circle algorithm in cCode for program to draw a circle using mid point circle algorithm in c
Code for program to draw a circle using mid point circle algorithm in c
 
اسلاید دوم جلسه پنجم کلاس پایتون برای هکرهای قانونی
اسلاید دوم جلسه پنجم کلاس پایتون برای هکرهای قانونیاسلاید دوم جلسه پنجم کلاس پایتون برای هکرهای قانونی
اسلاید دوم جلسه پنجم کلاس پایتون برای هکرهای قانونی
 
Muzzammilrashid
MuzzammilrashidMuzzammilrashid
Muzzammilrashid
 
Dynamic Program Problems
Dynamic Program ProblemsDynamic Program Problems
Dynamic Program Problems
 
Concatenation of two strings using class in c++
Concatenation of two strings using class in c++Concatenation of two strings using class in c++
Concatenation of two strings using class in c++
 
PF LAB ASSIGNMENT
PF LAB ASSIGNMENTPF LAB ASSIGNMENT
PF LAB ASSIGNMENT
 
Program: Inheritance in Class - to find topper out of 10 students
Program: Inheritance in Class - to find topper out of 10 studentsProgram: Inheritance in Class - to find topper out of 10 students
Program: Inheritance in Class - to find topper out of 10 students
 
Bcsl 033 data and file structures lab s3-3
Bcsl 033 data and file structures lab s3-3Bcsl 033 data and file structures lab s3-3
Bcsl 033 data and file structures lab s3-3
 
Ruby haskell extension
Ruby haskell extensionRuby haskell extension
Ruby haskell extension
 

Viewers also liked

The final assignment of computer slideshare
The final assignment of computer slideshareThe final assignment of computer slideshare
The final assignment of computer slideshare
ABRAM MPHUTI
 
computer science sample papers 3
computer science sample papers 3computer science sample papers 3
computer science sample papers 3
Swarup Kumar Boro
 

Viewers also liked (7)

The final assignment of computer slideshare
The final assignment of computer slideshareThe final assignment of computer slideshare
The final assignment of computer slideshare
 
History of the computer
History of the computerHistory of the computer
History of the computer
 
CBSE Question Paper Computer Science with C++ 2011
CBSE Question Paper Computer Science with C++ 2011CBSE Question Paper Computer Science with C++ 2011
CBSE Question Paper Computer Science with C++ 2011
 
Cbse class 10 computer science sample paper sa1 2014 (1)
Cbse class 10 computer science sample paper sa1 2014 (1)Cbse class 10 computer science sample paper sa1 2014 (1)
Cbse class 10 computer science sample paper sa1 2014 (1)
 
Sample Paper 2 Class XI (Computer Science)
Sample Paper 2 Class XI (Computer Science)Sample Paper 2 Class XI (Computer Science)
Sample Paper 2 Class XI (Computer Science)
 
Computer Assignment
Computer AssignmentComputer Assignment
Computer Assignment
 
computer science sample papers 3
computer science sample papers 3computer science sample papers 3
computer science sample papers 3
 

Similar to Assignment c++12

Assignement of programming & problem solving u.s ass.(1)
Assignement of programming & problem solving u.s ass.(1)Assignement of programming & problem solving u.s ass.(1)
Assignement of programming & problem solving u.s ass.(1)
Syed Umair
 
Assignement of programming & problem solving ass.(3)
Assignement of programming & problem solving ass.(3)Assignement of programming & problem solving ass.(3)
Assignement of programming & problem solving ass.(3)
Syed Umair
 
C++11 concurrency
C++11 concurrencyC++11 concurrency
C++11 concurrency
xu liwei
 
1 borland c++ 5.02 by aramse
1   borland c++ 5.02 by aramse1   borland c++ 5.02 by aramse
1 borland c++ 5.02 by aramse
Aram SE
 
Oops practical file
Oops practical fileOops practical file
Oops practical file
Ankit Dixit
 

Similar to Assignment c++12 (20)

Assignement of programming & problem solving u.s ass.(1)
Assignement of programming & problem solving u.s ass.(1)Assignement of programming & problem solving u.s ass.(1)
Assignement of programming & problem solving u.s ass.(1)
 
Assignement of c++
Assignement of c++Assignement of c++
Assignement of c++
 
Assignement of programming & problem solving ass.(3)
Assignement of programming & problem solving ass.(3)Assignement of programming & problem solving ass.(3)
Assignement of programming & problem solving ass.(3)
 
Bijender (1)
Bijender (1)Bijender (1)
Bijender (1)
 
Qno 1 (d)
Qno 1 (d)Qno 1 (d)
Qno 1 (d)
 
C questions
C questionsC questions
C questions
 
C++11 concurrency
C++11 concurrencyC++11 concurrency
C++11 concurrency
 
pattern-printing-in-c.pdf
pattern-printing-in-c.pdfpattern-printing-in-c.pdf
pattern-printing-in-c.pdf
 
Pattern printing-in-c(Jaydip Kikani)
Pattern printing-in-c(Jaydip Kikani)Pattern printing-in-c(Jaydip Kikani)
Pattern printing-in-c(Jaydip Kikani)
 
2014 computer science_question_paper
2014 computer science_question_paper2014 computer science_question_paper
2014 computer science_question_paper
 
1 borland c++ 5.02 by aramse
1   borland c++ 5.02 by aramse1   borland c++ 5.02 by aramse
1 borland c++ 5.02 by aramse
 
Write C++ program that when given a value N(read from cin)- produces a.docx
Write C++ program that when given a value N(read from cin)- produces a.docxWrite C++ program that when given a value N(read from cin)- produces a.docx
Write C++ program that when given a value N(read from cin)- produces a.docx
 
CS6311- PROGRAMMING & DATA STRUCTURE II LABORATORY
CS6311- PROGRAMMING & DATA STRUCTURE II LABORATORYCS6311- PROGRAMMING & DATA STRUCTURE II LABORATORY
CS6311- PROGRAMMING & DATA STRUCTURE II LABORATORY
 
Qno 1 (c)
Qno 1 (c)Qno 1 (c)
Qno 1 (c)
 
54602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee0108310154602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee01083101
 
C++ manual Report Full
C++ manual Report FullC++ manual Report Full
C++ manual Report Full
 
C++ Certified Associate Programmer CPA
C++ Certified Associate Programmer CPAC++ Certified Associate Programmer CPA
C++ Certified Associate Programmer CPA
 
Oops practical file
Oops practical fileOops practical file
Oops practical file
 
Programming fundamentals
Programming fundamentalsProgramming fundamentals
Programming fundamentals
 
Programming Under Unix and Linux
Programming Under Unix and LinuxProgramming Under Unix and Linux
Programming Under Unix and Linux
 

More from Syed Umair (20)

Assignement code
Assignement codeAssignement code
Assignement code
 
Tree 4
Tree 4Tree 4
Tree 4
 
Title page
Title pageTitle page
Title page
 
S.k
S.kS.k
S.k
 
Q.a
Q.aQ.a
Q.a
 
Prog
ProgProg
Prog
 
Perception
PerceptionPerception
Perception
 
New microsoft office word document
New microsoft office word documentNew microsoft office word document
New microsoft office word document
 
New microsoft office word document (2)
New microsoft office word document (2)New microsoft office word document (2)
New microsoft office word document (2)
 
M.b
M.bM.b
M.b
 
C++ 4
C++ 4C++ 4
C++ 4
 
B.g
B.gB.g
B.g
 
Assignement of programming & problem solving
Assignement of programming & problem solvingAssignement of programming & problem solving
Assignement of programming & problem solving
 
Assignement of discrete mathematics
Assignement of discrete mathematicsAssignement of discrete mathematics
Assignement of discrete mathematics
 
A.i
A.iA.i
A.i
 
H m
H mH m
H m
 
Prog
ProgProg
Prog
 
Assignement of discrete mathematics
Assignement of discrete mathematicsAssignement of discrete mathematics
Assignement of discrete mathematics
 
Assignement c++
Assignement c++Assignement c++
Assignement c++
 
Truth table a.r
Truth table a.rTruth table a.r
Truth table a.r
 

Recently uploaded

Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training Report
Avinash Rai
 

Recently uploaded (20)

GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & EngineeringBasic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training Report
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx
 
Salient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptxSalient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptx
 
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
Operations Management - Book1.p  - Dr. Abdulfatah A. SalemOperations Management - Book1.p  - Dr. Abdulfatah A. Salem
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
 
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxslides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptxSolid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
 
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
 
Forest and Wildlife Resources Class 10 Free Study Material PDF
Forest and Wildlife Resources Class 10 Free Study Material PDFForest and Wildlife Resources Class 10 Free Study Material PDF
Forest and Wildlife Resources Class 10 Free Study Material PDF
 
Matatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptxMatatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptx
 
Benefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational ResourcesBenefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational Resources
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 

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:
  • 3. /*Show 1st 8 FIBONACCI Number */ #include<iostream.h> #include<conio.h> void main() { clrscr(); longint a=21,b=0,c=1,sum; while(b<a) { cout<<c<<" "; sum=b+c; b=c; c=sum; } 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: