#include <iostream>
using namespace std ;
int main()
{
int number_of_days = 700 ;
int years = number_of_days / 365 ;
int weeks = (number_of_days % 365 ) / 7 ;
int days = (number_of_days % 365 ) % 7 ;
}
return 0 ()
The main assignment is to program a code that convert days to years, weeks, days, hours, minutes`
CodePudding user response:
You have Syntax Errors here.
you need to have [return 0] statement inside the scope of the main function because main() function is of type integer and you need to return some integer so put the [return 0] inside the scope {} of main
return, like any other statement in C needs a [;] after it to end the statement, so replace () with ; to have | return 0; |
Check your logic again, I couldn't figure out why days = (number_of_days % 365 ) % 7
CodePudding user response:
I think the main problem is return 0(). Please try this one.
int main()
{
int number_of_days = 700 ;
int years = number_of_days / 365 ;
int weeks = (number_of_days % 365 ) / 7 ;
int days = (number_of_days % 365 ) % 7 ;
return 0;
}
If you use return 0()
you will get below error.
error: called object type 'int' is not a function or function pointer
Also please try to keep the return 0;
inside main function.