[ create a new paste ] login | about

Link: http://codepad.org/Nk4Ovmku    [ raw code | output | fork ]

C, pasted on Oct 10:
1
2
3
4
5
6
7
8
9
10
11
12
int main() {
  int cents = 234; 
  int num;
  int dollars = 0;

  if((num = cents/100) > 0) {
    dollars = dollars + num;
    cents = cents - (100 * num);
  }
  printf("%d.%d", dollars, cents); 
  return 1;
}


Output:
1
2.34


Create a new paste based on this one


Comments: