0% found this document useful (0 votes)
43 views11 pages

Assignment 1

Uploaded by

muntasibjunaidi
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)
43 views11 pages

Assignment 1

Uploaded by

muntasibjunaidi
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

// problem 1

cout << "Welcome to NIT Warangal"<< endl ;

// problem 2

int a, b ;

cin>> a >> b ;

int q = a + b ;

int r = a- b ;

int s = a* b ;

int t = a/ b ;

int u = a % b ;

cout<<" the addition of two numberis : " << q << endl << " the subtraction of this two numbers is
: "<< r << endl << "the product of this two numbers is :"<< s << endl << " the divison of these two
numbers is : "<< t << endl << "the remander of the first number when divided by second number is :"<<
u << endl ;

//problem 3
int n ;

cin >> n ;

cout << " the distance in meters is : "<< n * 1000 << endl << " the distance in centmeters is : "<< n *
1000000 << endl << " the distance in feet is : "<< n* 3280.84 << endl <<" the distance in inches is : "<<
n* 39370.1 << endl ;

// problem 4

int a = 7 ;

int b = 8 ;

int c ;

c=a;

a= b ;

b=c ;

cout << a << endl << b << endl ;


int a = 6 ;

int b = 5 ;

a = a +b ;

b=a-b;

a=a-b;

cout << a <<endl << b << endl ;

// problem 5

int n ;

cin >> n ;

cout << " the sum of first and last digit of :"<< (n% 10) + ( n% 10000 - n% 1000)/ 1000 << endl ;

// problem 6
int costprice , mrp , discount ;

cin >> costprice >> mrp >> discount ;

if ( mrp - (discount * mrp)/(100 )>= costprice ){

cout << " the seller has made a profit " << endl ;

cout << " the seller has a profit of " << ( mrp - (mrp * discount)/ 100 ) -(costprice ) ;}

else {

cout << " the seller has made a loss :"<< endl ;

cout <<" the loss is : "<< costprice - ( mrp - (mrp * discount)/ 100 ) ;

}
// problem 7

cout<<". Paper of size A0 has dimensions 1189 mm × 841 mm."<< endl ;

cout<<". Paper of size A1 has dimensions 841 mm × 594 mm."<< endl ;

cout<<". Paper of size A2 has dimensions 594 mm × 420 mm."<< endl ;

cout<<". Paper of size A3 has dimensions 420 mm × 297 mm."<< endl ;

cout<<". Paper of size A4 has dimensions 297 mm × 210 mm."<< endl ;

cout<<". Paper of size A5 has dimensions 210 mm × 148 mm."<< endl ;

cout<<". Paper of size A6 has dimensions 148 mm × 105 mm."<< endl ;

cout<<". Paper of size A7 has dimensions 105 mm × 74 mm."<< endl ;

cout<<". Paper of size A8 has dimensions 74 mm × 52 mm."<< endl ;

// problem 9

int brandingexpenses, travelexpenses, foodexpenses, logisticsexpenses, total ;

cin >> brandingexpenses>> travelexpenses>> foodexpenses>> logisticsexpenses ;

total= brandingexpenses + travelexpenses + foodexpenses+ logisticsexpenses ;

cout << " the total expenses are :"<< total << "Branding expenses percentage:"<<
brandingexpenses*100 / total << endl <<"Travel expenses percentage:"<<travelexpenses*100/total<<
"Food expenses percentage: "<< foodexpenses*100/ total << endl << "Logistics expenses
percentage:"<< logisticsexpenses*100 /total << endl ;
// problem 8

int a , b ;

cin >> a >> b ;

cout << (a&b) << endl << ( a|b)<< endl << (a>>2)<< endl << (b>>2)<< endl<<
(a^b)<<endl ;

// prroblem 10

int a , b , c , d , e , f , s ;
cin >> a>> b>> c>> d>> e>> f ;

s = a+ b+ c+ d+ e+ f ;

cout << "the aggregate marks are s : "<< s<< endl <<"the percentage marks are :"<< (s*100)/
600 << endl ;

// problem 11

int n ;

cin >> n ;
cout << " smallest number of notes that will combine to give the respected input is :"<< (n
/100) + (n%100)/50 + ((n%100)%50)/10 + (((n%100)%50)%10 )/5 + ((((n%100)%50)%10 )%5)/2 +
(((((n%100)%50)%10 )%5)%2) / 1 << endl ;

// problem 12

float r1 , r2 , f1 , f2 ;

cin >> r1 >> r2 >> f1 >> f2 ;

cout << " the mileage of the car is :"<< (r2 - r1)/(f1 - f2)<< endl ;
// problem 13

int n ;

cin >> n ;

if((n%4)==0){

cout << "the given year is leap year : "<<n << endl ; }

else {

cout << " the given year is not a leap year :"<< endl ;

}
// problem 14

char a = 12 ;

cout<< " the ascii equivalent of 12 is :"<< a << endl ;

// problem 15

int n ;

cin >> n ;

cout<< " the people on first day are :"<< (2*n)/7 << endl << "the people on
second day is :"<< (4*n)/7 << endl << " the people on third day are :"<< n /7 << endl ;

You might also like