Mail Archives: djgpp/1997/07/29/19:52:30
From: | "Michèle C. Dupré" <forbinky AT ix DOT netcom DOT com>
|
Newsgroups: | comp.lang.c,comp.os.msdos.djgpp
|
Subject: | having trouble with long numbers
|
Date: | 29 Jul 1997 18:56:00 GMT
|
Organization: | Netcom
|
Lines: | 37
|
Message-ID: | <01bc9c51$0ceeec80$78ed1fcc@darkstar>
|
NNTP-Posting-Host: | nor-la3-24.ix.netcom.com
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
(using DJGPP on a Win95 Box)
Can't decide which variable to use with which scanf code.
I want to be able to have more than 10 digits print out (if the age were
10,000 years for example).
I am new to C (and programming in general) and teaching myself, so any
criticism will be appreciated.
Also can someone direct me to the FAQ(so that I can RTFM)?
Thanx.
Below is my code.
Cut------------------------------Cut
#include <stdio.h>
int main()
{
int daysper, daystotal, secondsperday, years;
long long totalseconds;
daysper = 365;
secondsperday = 86400;
printf("My second handmade program!\n\nTo tell you the number of seconds
(estimate) you have lived.\n\n");
printf("Enter your age in years: ");
scanf("%d", &years);
daystotal=(daysper * years);
printf("Total days = %d\n\n", daystotal);
totalseconds=(daystotal * secondsperday);
printf("The total number of seconds is: %i\n",totalseconds);
return 0;
}
End------------------------------End
- Raw text -