Instructions:
Sample Results:
Input
Multiple lines containing an integer.
2
6
Output
Multiple lines containing an integer.
4
36
Create a structure called fraction. It has two members, both type int, called numerator and
denominator. Write a program that input values in two variables of type fraction. Add both
fractions and print the result in fraction format.
Ask the use if they want a cup of tea. If they replay with “no” or “n” repeat the question. Once the loop stops display the message “Sorry,we have run out of tea”
Ask the user to input a number and then ask if they want to double the number. If they answer “y”multiply the number by 2 and display the answer. Keep repeating this loop, doubling their number each time, until they no longer reply “y”.
Average of the given numbers
Looping problem:-
Input two positive integers a and b from the user. Determine the remainder of a/b. Assume that the division and modulus operators are not available.
Looping problem:-
Input two positive integers a and b from the user. Determine the integer quotient of a/b. Assume that the division operator is not available.
Looping problem:-
Write an if-else statement that outputs the word "Warning" provided that either the value of the variable temperature is greater than or equal to 100, or the value of the variable pressure is greater than or equal to 200, or both. Otherwise, the if-else statement outputs the work "OK".
Three numbers denoted by the variables A, B and C are supplied as input data. Print these three numbers in ascending order.
Looping problem:
Multiply a number with the sum of its digits.