Southbay Robotic and Coding Center
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Challenge 5

Go down

Challenge 5 Empty Challenge 5

Post by Admin Mon Aug 28, 2017 4:33 pm

Given a year, return the century it is in. The first century spans from the year 1 up to and including the year 100, the second - from the year 101 up to and including the year 200, etc.
Admin
Admin
Admin

Posts : 25
Join date : 2017-08-17
Location : Torrance CA

http://southbayrobot.com

Back to top Go down

Challenge 5 Empty Re: Challenge 5

Post by Admin Mon Aug 28, 2017 4:33 pm

int centuryFromYear(int year) {
int century;
if (year % 100 == 0) {
century= year / 100;
} else {
century = (year / 100) + 1;
}
return century;
}
Admin
Admin
Admin

Posts : 25
Join date : 2017-08-17
Location : Torrance CA

http://southbayrobot.com

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum