## KoubaK 7

hey, guys im new to UNIX and i need help.. I need to write a script which will tell you if you entered an even (e.g., 2, 4, 6...) or odd number (e.g., 1, 3, 5...) and then give you the summation of the number you entered. For example, if you entered 5 it will give 15 (1+2+3+4+5). I'm suppose to use if and loops .. I got no idea on how to do so.. below is what I got sooo far!

``````#!/bin/bash
echo " This script will tell you if you entered an even (e.g., 2, 4, 6...) or odd number (e.g., 1, 3, 5...) and then give you the summation of the number you entered. For example, if you entered 5 it will give 15 (1+2+3+4+5)"
echo 'Please, enter an integer number (e.g., 1, 2, 3...) and PRESS ENTER:'
fi``````

and I am to follow this example!

``````This script will tell you if you entered an even (e.g., 2, 4, 6...) or odd number (e.g., 1, 3, 5...) and then give you the summation of the number you entered. For example, if you entered 5 it will give 15 (1+2+3+4+5)
name
Please, enter an integer number (e.g., 1, 2, 3...) and PRESS ENTER: 6
name you have entered 6 please see the results
The number you entered 6 is an even number
The summation of 6 is 21``````

## pheeror 12

``````#!/bin/bash
if [ \$(( vstup % 2 == 0 )) -eq 0 ]; then
echo "even"
else
echo "odd"
fi
SUM=0
for i in `seq 1 \$vstup`; do
SUM=\$(( \$SUM + \$i ))
done
echo \$SUM``````

Thanks man!!! ;)