Please Help me

Hi Peoples, really need some help. I am in my first year at Uni studying Forensic Computing. And I am stuck with C! Here is on of my questions that I need to answer.

The 24 hours in a day have to be divided up around the 360 degrees of the globe. Every time you go 15 degrees east of Greenwich, you get an hour later; every time you go 15 degrees west, you get an hour earlier.
Complete the following program, prog4.c by defining the function worldTime() which

1. takes two parameter gmt and longitude of type int
longitude is the number of degrees east(positive) or west (negative) of Greenwich and gmt is the time (in hours) at Greenwich.
2. calculates the time at that location and returns it as a result of type int

#include "/home6/drs/include/simpleio.h"

int worldTime(int gmt, int longitude)
/* complete the definition of the function worldTime() here */

int main()
int time;

printf("enter a Greenwich Time");
time = getInt();

printf("The time in London is %d
printf("The time in Tokyo is %d
",worldTime(time, 140));
printf("The time in Sydney is %d
",worldTime(time, 152));
printf("The time in Auckland is %d
",worldTime(time, 180));
printf("The time in New York is %d
",worldTime(time, -75));
printf("The time in L.A. is %d
return 0;

Compile prog4 and test that it works.
Note that your calculation must allow for the fact that there are only 24 hours in a day.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!