Presentation is loading. Please wait.

Presentation is loading. Please wait.

COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

Similar presentations


Presentation on theme: "COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT"— Presentation transcript:

1 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
C++ CODES PART#06 COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

2 Calculate area of a circle using a=pi*r*r
#include<iostream.h> #include<conio.h> void main() { clrscr(); float rad; const float pi= f; cout<<"Enter Radious :"; COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

3 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
CONTINUE… cin>>rad; float area=pi*rad*rad; cout<<"Area is :"<<area<<endl; getch(); } COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

4 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Output….. COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

5 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Do While loop #include<constream.h> void main() { clrscr(); int a; a=1; do COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

6 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
CONTINUE…. { cout<<a<<endl;a++; } while (a<11); getch();} COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

7 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Output… COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

8 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Using power function #include<constream.h> #include<math.h> void main() {clrscr(); int a,b,c; cout<<"enter the limit upto where you want the series"; COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

9 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Continue…. cin>>a; for(b=1;b<=a;b++) {c=pow(b,2); cout<<c<<" ";} cout<<"this series is the required one"; getch();} COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

10 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Output… COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

11 Generate series as shown in the output…
#include<constream.h> #include<math.h> void main() {clrscr(); int a,b,c; cout<<"enter limit"; COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

12 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Continue… cin>>a; for(b=1;b<=a;b++) {c=2*b*pow(-1,b); cout<<c<<" ";} cout<<"this series is the required one"; getch();} COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

13 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Output…. COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

14 Generate series as shown in the output…
#include<constream.h> #include<math.h> void main() {clrscr(); int a,b,c; cout<<"enter the last limit"; cin>>a; COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

15 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Continue…. for(b=1;b<=a;b++){ c=2*b*pow(-1,b+1); cout<<c<<" ";} cout<<"hence this is the required series"; getch();} COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

16 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Output….. COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

17 Generate series as shown in the output…
#include<constream.h> #include<math.h> void main() {clrscr(); int a,b,c; cout<<"enter the last limit"; cin>>a; COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

18 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Continue….. for(b=0;b<=a;b++) {c=pow(3,b); cout<<c<<" ";} cout<<"this series is the required one"; getch();} COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

19 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Output….. COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

20 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
While loop #include<constream.h> void main() {clrscr(); int n; while(n!=0) cin>>n; cout<<endl; getch();} COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

21 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Output….. User enters many numbers when he/she enters zero so program terminates COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

22 Generate series as shown in output using while loop
#include<constream.h> #include<math.h> void main() { clrscr(); int a,b,r; cout<<"plz enter your limit"; COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

23 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Continue…. cin>>b; a=1; while(a<=b) {r=2*a*pow(-1,a+1); cout<<r<<" "; a++;} getch();} COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

24 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Output….. COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

25 Generate series as shown in output using while loop
#include<constream.h> #include<math.h> void main() {clrscr(); int a,b,r; cout<<"enter limit"; cin>>b; COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

26 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Continue…. a=0; while(a<b) {r=pow(3,a); cout<<r<<" "; a++;} getch();} COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

27 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Output…. COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

28 Generate series as shown in output using while loop
#include<constream.h> #include<math.h> void main() { clrscr(); int a,b,r; cout<<"enter the limit"; COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

29 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Continue… cin>>b; a=1; while (a<=b) {r=pow(a,2); cout<<r<<" "; a++;} getch();} COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

30 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Output….. COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

31 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Do-while loop #include<constream.h> void main() {clrscr(); long dividend,divisor; char ch; do { COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

32 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Continue… cout<<"enter dividend:"; cin>>dividend; cout<<"enter divisor:"; cin>>divisor; cout<<"quotient is "<<dividend/divisor; COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

33 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Continue…. cout<< " , remainder is "<<dividend%divisor; cout<<" \n do another?(y/n):"; cin>>ch;} while (ch!='n'); getch();} COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

34 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Output….. COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

35 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
CONCLUSION NICE WORDINGS…. It is more difficult to stay on top than to get there. The secret of success is that we never, never give up Barish ka Qatra Seepi or Sanp dono kay Munah mein girta hai Jab keh Sanp ussay Zehar bana deta hai aur Seep Usay Moti. Jis ka jaisa "Zarf" waisi Uss ki "Takhleeq" . COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT


Download ppt "COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT"

Similar presentations


Ads by Google