₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,330,303 members, 8,444,867 topics. Date: Tuesday, 14 July 2026 at 07:48 AM

Toggle theme

18SepPython's Posts

Nairaland Forum18SepPython's Profile18SepPython's Posts

1 (of 1 pages)

ProgrammingRe: I Want To Learn Programming. Which Language Should I Start With? by 18SepPython: 6:47am On Sep 24, 2017
FamDamSam:
So, you, to start with. Which of the languages would you teach me?
I have tried that of HelloWorldApp on my system I mean that Java stuff but it seems my system can't run it
i just started my programming journey and i'm learning C language.
ProgrammingRe: I Want To Learn Programming. Which Language Should I Start With? by 18SepPython: 11:44pm On Sep 23, 2017
FamDamSam:
I want to start from somewhere
start with me smiley
ProgrammingRe: I Want To Learn Programming. Which Language Should I Start With? by 18SepPython: 11:38pm On Sep 21, 2017
please i need help with this(C programming)

Question: Write a program to calculate the sum of the first and the second last digit of a 5 digit number entered from the keyboard.

solution..

#include <stdio.h>
main(){
int n, first, second, third, forth, fifth, sum;
printf("Enter a 5-digit number\n"wink;
scanf("%d", &n);
/*Now we will take out each digit of this number and then finally add the first and the second last digits*/
first = n/10000; //first digit
n = n%10000;

second = n/1000; //second digit
n = n%1000;

third = n/100; //third digit
n = n%100;

forth = n/10; //forth digit
fifth = n%10; //fifth digit

sum = first + forth;
printf("sum : %d\n", sum);
}

i understand the flow but want to know why

1. n/10000;
2. n = n%1000;

Please help i have been stack with this for days.Thanks

1 (of 1 pages)