newbie in c and issue with integers [migrated]
- by user2527918
//
// main.c
// cmd4
//
// Created by Kevin Rudd on 27/06/13.
// Copyright (c) 2013 Charlie Brown. All rights reserved.
//
#include <stdio.h>
int main(int argc, const char * argv[])
{
int x =10, y =20, b = 500;
int z = x*y;
int f = z/b;
// insert code here...
printf("x is:%d, y is:%d, b is %d\n",x,y,b);
printf("x times y is: %d\n",z);
printf("z divided by b is: %d\n",f);
return 0;
}
on print out f = 0. Why?