[ create a new paste ] login | about

Link: http://codepad.org/j1pckw0y    [ raw code | output | fork | 3 comments ]

C, pasted on Apr 25:
1
2
3
4
5
6
7
8
9
10
11
#include <stdio.h>

void main() {
    int a;
    float b, c, d;
    a = 750;
    b = a / 350;
    c = 750;
    d = c / 350;
    printf("%.2f\n%.2f", b, d);
}


Output:
1
2
2.00
2.14


Create a new paste based on this one


Comments:
posted by Nahin on Dec 25
yes..I can explain. here you declared 2 types variable .first u got round figure because 'a' is an integer type variable and 'b' is a floating type variable that is why u got a round figure answer.if we want to get floating type answer,we should take this answer as a floating type variable and also divide by floating type variable.
reply
posted by ASSSTrfffh on Aug 8
thank you...
reply
posted by ASSSTrfffh on Aug 8
cancel the comment.
reply