Tuesday, 4 September 2012

Write a menu driven Program to covert no of years into second,minutes,hours,days and month.

  • Write a menu driven Program to covert no. of years into second,minutes,hours,days and month.
#include <stdio.h>
#include <conio.h>
void main()
{
    int yr;
    double f;
    int ch;
    printf("Enter the number of years");
    scanf("%d",&yr);
    printf("Enter your choise:\n");
    printf("1 for seconds\n");
    printf("2 for minutes\n");
    printf("3 for hours\n");
    printf("4 for days\n");
    printf("5 for months\n");
    scanf("%d",&ch);
    switch(ch)
    {
        case 1:
        f=yr*365*24*60*60;
        break;
        case 2:
        f=yr*365*24*60;
        break;
        case 3:
        f=yr*365*24;
        break;
        case 4:
        f=yr*365;
        break;
        case 5:
        f=yr*12;
        break;
        default:
        printf("Worng Choise");
    }
    }
    printf("%lf",f);
    }

No comments:

Post a Comment