lecture_notes_15 - I I - -...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
I I - --
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
12.4.c #include <stdio.h> int mainO { int amount; int rate; int ti.me; /* The number of bytes to be transferred */ /* The average network transfer rate */ /* The ti.me, i.n seconds, for the transfer */ i.nt hours; i.nt mi.nutes; int seconds; /* The n~er of hours for the transfer /* The number of mins for the transfer /* The number of secs for the transfer */ */ */ /* Get input: number of bytes and network transfer rate */ pri.ntf("How many bytes of data to be transferred? "); scanf("%d", &amount); pri.ntf("What is the transfer rate (in bytes/see)? "); scanf("%d", &rate); /* Calculate total time in seconds */ ~ ti.me = amount / rate; /* Convert time into hours, minutes, seconds */ hours = ti.me / 3600; /* 3600 seconds in an hour */ mi.nutes = (ti.me % 3600) / 60; /* 60 seconds in a minute */ seconds = ((ti.me % 3600) % 60); /* remainder is seconds */ /* Output results */ pri.ntf("Transfer Time: %dh %dm%ds\n", hours, mi.nutes, seconds);
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/21/2011 for the course MATH 243 taught by Professor Gao during the Spring '08 term at University of Illinois, Urbana Champaign.

Page1 / 14

lecture_notes_15 - I I - -...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online