Write a program in C language for the exercise using a For Statement.
For Statement:
- Entry controlled loop
- Number of iterations are pre-decided
for (initialization; test condition; increment or decrement)
{
body of the loop
}
Figure: for loop
Exercise: Write a program to take input a number from the user. Calculate the sum of alternative digits, i.e. find the sum of digits at even positions and the sum of digits at odd positions, and print both of them on the screen.