Algorithm 1 - Century From Year
Q.
Description:
Introduction
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.
Task :
Given a year, return the century it is in.
Input , Output Examples :
1705 --> 18
1900 --> 19
1601 --> 17
2000 --> 20
A)
int centuryFromYear(int year)
{
int save = 0;
float a = 0.0f;
save = year / 100;
a = year - (save * 100);
if (a > 0)
save = save + 1;
return save;
}
Author And Source
이 문제에 관하여(Algorithm 1 - Century From Year), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://velog.io/@ad-astra/Algorithm-1-Century-From-Year
저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
int centuryFromYear(int year)
{
int save = 0;
float a = 0.0f;
save = year / 100;
a = year - (save * 100);
if (a > 0)
save = save + 1;
return save;
}
Author And Source
이 문제에 관하여(Algorithm 1 - Century From Year), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://velog.io/@ad-astra/Algorithm-1-Century-From-Year저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)