Write a program to swap value of two variables without


Question 1 : Write a program to swap value of two variables without using third variable.

Question 2 : Write a program which input three numbers and display the largest number using ternary operator.

Question 3 : Write a program which accepts amount as integer and display total number of Notes of Rs. 500, 100, 50, 20, 10, 5 and 1.
For example, when user enter a number, 575,

the results would be like this...

500: 1
100: 0
50: 1
20: 1
10: 0
5: 1
1: 0

Question 4 :  Write a program which accepts a character and display its next character.

Question 5 : Write a program which accepts days as integer and display total number of years, months and days in it.
For example:  If user input as 856 days the output should be 2 years 4 months 6 days.

Question 6 : What is the output of following program?
int result = 4 + 5 * 6 + 2;
cout << result;
int a = 5 + 7 % 2;
cout << a;

Question 7 : What is the output of following program?
int x = 10, y;
y = x++;
cout << y;
int x = 10, y;
y = x++;
cout << x;
int x = 10;
x++;
cout << x;
int x = 10, y;
y = ++x;
cout << y;
int x = 10;
cout << ++x;
int x = 10;
cout << x++;

Question 8 : What is the output of following program?
int x = 10, y;
y = x + x++;
cout << y;
int x = 10,y;
y = ++x + x++ + x;
cout << y; 
int x = 10, y;
y = x++ + x + ++x;
cout << y;

Question 9 : What is the output of following program?
cout << setw(5) << 77 << endl;
cout << setw(5) << 100 << endl;
cout << setw(5) << 12312 << endl;

Question 10 : What is the output of following program?
float net = 5689.2356;
cout.precision(2);
cout.setf(ios::fixed | ios::showpoint);
cout << net << endl;

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Write a program to swap value of two variables without
Reference No:- TGS01401586

Now Priced at $20 (50% Discount)

Recommended (94%)

Rated (4.6/5)