Monday, December 10, 2007

How to use variable and constant

How to use variable and constant

To use variable and constant

#include

#define GRAMS_PER_POUND 454

const int CENTURY = 2000;

long weight_grams, weight;

int year, age2000;

main()

{ printf("Enter your weight here : ");

scanf("%d", &weight);

printf("Enter your year of birth: ");

scanf("%d", &year);

weight_grams = weight * GRAMS_PER_POUND;

age2000 = CENTURY - year;

printf("\nYour weight in is = %ld", weight);

printf("\nIn 2000 you will be %d years old\n", age2000);

return 0;

}

Result :

1 comment:

Unknown said...

i like this blog.. all tutorial in this blog is usefully.. thanks for sharing