31.(C) Codeforces 617 A--->>>An elephant

 #include<stdio.h>

/*A. Elephant
time limit per test1 second
memory limit per test256 megabytes
inputstandard input
outputstandard output
An elephant decided to visit his friend. It turned
out that the elephant's house is located at the point
0 and his friend's house is located at point x(x > 0)
of the coordinate line. In one step the elephant can
move 1, 2, 3, 4 or 5 positions forward. Determine,
what is the minimum number of steps he needs to make
in order to get to his friend's house.

Input
The first line of the input contains an integer
x (1 ≤ x ≤ 1 000 000) — The coordinate of the friend's house.

Output
Print the minimum number of steps that the elephant needs
to make to get from point 0 to point x.

Examples
inputCopy
5
output copy
1
inputCopy
12
output copy
3
Note
In the first sample, the elephant needs to make
one step of length 5 to reach the point x.

In the second sample, the elephant can get to point
x if he moves by 3, 5, and 4. There are other ways to
get the optimal answer but the elephant cannot reach
x in less than three moves.

*/
int main(){
    int a,n;
    scanf("%d",&a);
    n=a/5;
    if(a%5==0)// if the distance divisble by 5 then
    // it will print n as number of step
    {
        printf("%d",n);
    }
    else{
        printf("%d",n+1);// if there remains any
remainder then the step .
        // will be n+1 .bcz, the remainder will
be always 1,2,3 or 4.
        //1,2,3,4 indicate just one step
    }
// one thing to clarify here :
//if a<5 then the value of n will be fractional
// value but it will just take 0 as an integer value
// as we have declared n as int
Example:
4/5=0.8 but it will just take 0
and 0+1=1 .So, if we enter anything less than
5 then it will print just 1 step.

   

   
    return 0;
}

Comments