0% found this document useful (0 votes)
3 views

Assignment 1

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Assignment 1

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

1

#include <iostream>

using namespace std;

int main()

float n1, n2;

n1=2; n2=4;

cout << "the sum is\n"

cout << "Sum = " << n1+n2;

cout << "the subtraction is\n"

cout << "Sub = " << n1-n2;

cout << "the multiplication is\n"

cout << "Mul = " << n1*n2;

cout << "the remainder is\n"

cout << "Rem = " << n1%n2;

///////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

#include<iostream>

using namespace std;

int main()

float fahrenheit, celsius;


cout << "Enter the temperature in Celsius : ";

cin >> celsius;

fahrenheit = (celsius * 9.0) / 5.0 + 32;

cout << "The temperature in Celsius : " << celsius <<;

cout << "The temperature in Fahrenheit : " << fahrenheit;

return 0;

///////////////////////////////////////////////////

#include<iostream>

using namespace std;

int main(){

float sub1,sub2,sub3,sub4,sub5,perc,total;

cout<<“\n\t Enter the Marks obtained in 5 Subjects:”;

cin>>sub1>>sub2>>sub3>>sub4>>sub5;

total=sub1+sub2+sub3+sub4+sub5;

perc=(total/500)*100;

cout<<"\n The Percentage marks are:"<<perc;

return 0;

/////////////////////////////////////////////////////////////////

#include<iostream>

using namespace std;


int main(){

flaot gsal= 24000;

float x= (gsal/100)*10;

float taxsal= gsal-x;

float bonus= (gsal/100)*15;

gloat totsal= taxsal+bonus;

cout << "gross salary is :"<< gsal;

cout << "salary after tax deduciton is: "<< taxsa;

cout << "the bonus is "<< bonus;

cout << "salary plus bonus is :"<< totsal;

//////////////////////////////////////////////////////////////////////

#include<iostream>

using namespace std;

int main()

int x,square,cube;

cout << "Please enter a number: ";

cin >>x;

square = x*x;

cout << "Square of the number is " << square;


cube = x*x*x;

cout << "Cube of the number is " << cube ;

return 0;

////////////////////////////////////////////////////////////////

#include<iostream>

using namespace std;

int main(){

int mat,sci,arb,std,eng,x;

mat=80; sci=67; arb=65; std=88; eng=56;

x=(mat+sci+arb+std+eng)/5;

cout << "the mean is " << x;

/////////////////////////////////////////////////

#include<iostream>

#include<cmath>

using namespace std;

int main()
{

float a,b,c,s,Area;

cout<<"Enter three sides of triangle : ";

cin>>a>>b>>c;

s=(a+b+c)/2;

Area=sqrt(s*(s-a)*(s-b)*(s-c));

cout<<"Area of triangle is : "<<Area;

return 0;

///////////////////////////////////////////

#include<iostream>

#include<cmath>

int main (){

float a,b,c;

cout << "enter price per liter";

cin >> a;

cout << "enter customer price";

cin >> b;

cout <<"petrol in liters is:"<< b/a;

return 0;

///////////////////////////////////////////////////////
10

#include<iostream>

#include<cmath>

int main (){

float km,g;

km=55; g=8;

float gal=8/55;

cout >>"how much gallon is required for a single kilometer :"<<gal;

float new= gal * 95;

cout>>"no of gallons for 95 km"<<new;

return 0;

You might also like