Hi!
I have to write the programm, which will receive any number (at sec) and calculate it to weeks, days, hours, minutes and sec; for e.x. 4102 sec ---> 1h 8m and 22s
The problem is that it's forbidden to use atoi(), scanf() and simmilar functions. Insead of them, I should use getchar(), putchar(), printf().
So, I start with a converting string to int.
#include <stdio.h>
#include <stdlib.h>
/* MAIN */
int main()
{
int number;
int l;
while ((number = getchar()) != EOF)
{
l = cislo - '0';
putchar(l);
}
return 0;
}
It doesn't work as I want :( I hope you will help me. I'll accept any advice to write the program. Thank you!