Converts your age in years to days and displays both values. - C Language Basics

C examples for Language Basics:Hello World

Introduction

Don't worry about fractional years and leap years.

Demo Code

#include <stdio.h>  
int main(void) {  
    int ageyears;    /* age in years */  
    int agedays;    /* age in days  */  
                    /* w  w  w  . j a  v  a  2s  .c om*/
    ageyears = 101;  
    agedays = 365 * ageyears;  
    printf("An age of %d years is %d days.\n", ageyears, agedays);  
    return 0;  
}

Related Tutorials