This program also has some usage of the Modulus Operator.
If a four-digit number is input through the keyboard,
write a program to obtain the sum of the first and the last digit of this number.
/*HINT: If a number is divided using % , then the number to the right side of the decimal point
is the result. (This applies only to integers.) */
int number, last_digit, first_digit, total;
printf (" Enter the number which is to be operated on: ");
scanf ("%d", &number);
last_digit = number % 10;
total = last_digit;
first_digit = (number / 1000) % 10;
total = total + first_digit;
printf ("The total of the first and the last digit of the entered number is: %d", total);
/*This program is based on the "Sum of Digits" Program */
The File can be found out at: