[go: up one dir, main page]

0% found this document useful (0 votes)
14 views13 pages

C++ Programming Assignments

The document contains code submissions for 6 homework assignments in C++ by student 21F-9338 Anas Abdur Rahman. The code covers basics of input/output, variables, operators, conditional statements, loops and functions. Screenshots of the output are provided for each assignment. The last part contains a bad story and suggestion for a good story.

Uploaded by

saink4831
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views13 pages

C++ Programming Assignments

The document contains code submissions for 6 homework assignments in C++ by student 21F-9338 Anas Abdur Rahman. The code covers basics of input/output, variables, operators, conditional statements, loops and functions. Screenshots of the output are provided for each assignment. The last part contains a bad story and suggestion for a good story.

Uploaded by

saink4831
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

21F-9338

ANAS ABDUR RAHMAN


ASSIGNMENT NO:2
HOME TASK 1 CODE: -

//21F-9338_ANAS_ABDUR_RAHMAN_SECTION_C

#include <iostream>

using namespace std;

int main()

//DECLARING VARIABLES

int num;

int years,weeks,days;

cout<<"Enter Days:";

cin>>num; //Number of Days Given by the user

//FORMULAS USED

years=num/365;

weeks=(num-years*365)/7;

days=(num-years*365)%7;

//OUTPUTS

cout<<"\n Years:"<<years;

cout<<"\n Weeks:"<<weeks;

cout<<"\n Days:"<<days;
return 0;

Screenshot: -
HOME TASK 2 CODE: -
//21F-9338_ANAS_ABDUR_RAHMAN_SECTION_C

#include<iostream>

using namespace std;

int main()

//DECLARING VARIABLES.

int angle1,angle2,angle3;

//TAKING INPUTS FROM USER.

cout<<"Enter Angle No 1: ";

cin>>angle1;

cout<<"Enter Angle No 2: ";

cin>>angle2;

//FORMULA USED FOR TRIANGLE.

angle3=180-(angle1+angle2);

cout<<"Third Angle Will be:"<<angle3<<"Degree";

return 0;

Screenshot: -
HOME TASK 3 CODE: -

#include<iostream>

using namespace std;

int main()

//DECLARING VARIABLES

int eng,pf,la,dld,ict;

int prcnt,avrg,total,obt;

//TAKING VALUES FROM USER.

cout<<"Enter English Marks=";

cin>>eng;

cout<<"Enter Programming Fundamentals Marks=";

cin>>pf;

cout<<"Enter Linear Algebra Marks=";


cin>>la;

cout<<"Enter Digital Logic Design Marks=";

cin>>dld;

cout<<"Enter Information and Communication Technology Marks=";

cin>>ict;

//FORMULAS FOR CALCULATING.

total=500;

obt=eng+pf+la+dld+ict;

avrg=obt/5;

prcnt=obt*100/total;

//OUTPUTS

cout<<"Obtained Marks="<<obt;

cout<<" \n Total Marks="<<total;

cout<<" \n Average="<<avrg;

cout<<" \n Percentage="<<prcnt;

return 0;

Screenshot: -
HOME TASK 4 CODE:-

//21F-9338_ANAS_ABDUR_RAHMAN_SECTION_C

#include<iostream>

using namespace std;

int main()

//DECLARING VARIABES

int A,B;

//TAKING VALUES FROM USER.

cout<<"A=";

cin>>A;

cout<<"B=";

cin>>B;
//FORMULA

A=A+B;

B=A-B;

A=A-B;

cout<<"\n A="<<A;

cout<<"\n B="<<B;

return 0;

Screenshot: -

HOME TASK 5 CODE: -


//21F-9338_ANAS_ABDUR_RAHMAN_SECTION_C

#include<iostream>

using namespace std;

int main()

int Expression; //Declaring Variable of given Expression.

int a,b,c,d,f,g,h; //Declaring Variables which will be used in expression.

cout<<"a=";

cin>>a; //Taking the Value of 'a' from User.

cout<<"b=";

cin>>b; //Taking the Value of 'b' from User.

cout<<"c=";

cin>>c; //Taking the Value of 'c' from User.

cout<<"d=";

cin>>d; //Taking the value of 'd' from User.

cout<<"f=";

cin>>f; //Taking the vakue of 'f' from User.

cout<<"g=";

cin>>g; //Taking the value of 'g' from User.

cout<<"h=";

cin>>h; //Taking the value of 'h' from User.

Expression=((a*b)*c+(d+f)/g)-h;

cout<<"Expression="<<Expression;

return 0;
}

Screenshot: -

HOME TASK 6-A CODE:-

//21F-9338_ANAS_ABDUR_RAHMAN_SECTION_C

#include<iostream>

using namespace std;

int main()

cout<<" * * * * * * * * * ** \n";

cout<<" * * *\n";

cout<<" * * *\n";

cout<<" * * *\n";

cout<<" * * *\n";

cout<<" * * *\n";

cout<<" * * * * * * * * * * * * ** \n";

cout<<" * * *\n";

cout<<" * * *\n";

cout<<" * **** * *\n";


cout<<" * * * * *\n";

cout<<" * * * * *\n";

cout<<" * * * * *\n";

cout<<" * * * * *\n";

cout<<" * * * * * * * * * * * * ** \n";

return 0;

Screenshot: -

HOME TASK 6-B CODE:-

//21F-9338_ANAS_ABDUR_RAHMAN_SECTION_C
#include <iostream>

using namespace std;

int main(){

cout<<" ******* *******\n";

cout<<" ********** *********\n";

cout<<" ************ ***********\n";

cout<<" ************** *************\n";

cout<<" ********************************\n";

cout<<" ********************************\n";

cout<<" ********************************\n";

cout<<" ******************************\n";

cout<<" ****************************\n";

cout<<" **************************\n";

cout<<" ************************\n";

cout<<" **********************\n";

cout<<" ********************\n";

cout<<" ******************\n";

cout<<" ****************\n";

cout<<" **************\n";

cout<<" ************\n";

cout<<" **********\n";

cout<<" ********\n";

cout<<" ******\n";

cout<<" ****\n";

cout<<" **\n";

return 0;

}
Screenshot: -
BAD STORY:-
I Stayed up all night to prepare for my Quiz. Next
morning because of restlessness, I Was unable to even Understand the
Questions properly. :/

GOOD STORY:-
Idhr kuch Acha bhi Hota he? XD!

You might also like