Practical 1

Posted: January 20, 2012 in Lab 3

Problem Statement-
Write a program that takes an integer value representing the total number of minutes as input and outputs the corresponding number of days, hours and minutes. For example if the user enters 2000 minutes the program should output 1 day, 9 hours and 20 minutes. Your screen input and output should be similar to the following example:
Example:
Minute Converter
—————-
Enter the total number of minutes: 2000
2000 minutes is 1 days, 9 hours and 20 minutes

#include<stdio.h>
int minute(int *);
int main()
{
	int m;
	printf("Minute Converter\n");
	printf("-----------------------\n");
	printf("Enter the total no. of minutes\n");
	scanf("%d",&m);
	minute(&m);
return 0;
}
int minute(int *m)
{
int h,d,temp;
h=*m/60;
	temp=*m;
	*m=*m%60;
	d=h/24;
	h=h%24;
	printf("%d minutes is %d days, %d hours and %d minutes\n",temp,d,h,*m);
	return 0;
}
Advertisements
Comments
  1. shivani says:

    your website seems a boon to we students thanx alot:)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s