Integer Division

Lab C Beginner 10 points

Read two integers a and b. Print a / b, a % b and the exact quotient with 3 decimals using a cast.

Input

Two integers (b ≠ 0).

Output

Three lines.

Example

Input

7 2

Output

3
1
3.500
Sample input available Sample output available
Editor
C

Hints

int / int drops the fraction.

(double) a converts before dividing.

Solution explanation

The type of the operands decides the kind of division. In C, integer division truncates toward zero.

Show solution
#include <stdio.h>

int main() {
    int a, b;
    scanf("%d %d", &a, &b);
    printf("%d\n", a / b);
    printf("%d\n", a % b);
    printf("%.3f\n", (double) a / b);
    return 0;
}
Output
Answer
HOME LEARN COMMUNITY DASHBOARD