Problem hidden
|This problem was hidden by Editorial Board member probably because it has incorrect language|version or invalid test data, or description of the problem is not clear.|

ABR0067B - Цифрүүдийн нийлбэр

n натурал тоо өгөгдөв (n≤100). Цифрүүдийнх нь нийлбэрийг ол.

Input

n натурал тоо өгөгдөнө

Output

уг тооны цифрүүдийн нийлбэрийг хэвлэнэ

Example

Input:
87

Output:
15

Нэмсэн:sw40
Огноо:2007-10-31
Хугацааны хязгаарлалт:1s
Эх кодын хэмжээний хязгаарлалт:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Програмчлалын хэлүүд:Бүгд дараах хэлүүдээс бусад: ASM32-GCC MAWK BC C-CLANG NCSHARP CPP14 CPP14-CLANG COBOL COFFEE D-CLANG D-DMD DART ELIXIR ERL FANTOM FORTH GOSU GRV JS-RHINO JS-MONKEY JULIA KTLN NIM NODEJS OBJC OBJC-CLANG OCT PERL6 PICO PROLOG PYPY PYPY3 PY_NBC R RACKET RUST CHICKEN SQLITE SWIFT UNLAMBDA VB.NET
Эх сурвалж:Абрамов С. А.

hide comments
2024-02-20 06:09:16
Hamgiin simple code:
#include <bits/stdc++.h>
using namespace std;
main() {
int n, a = 0;
cin >> n;
while (n != 0) {
a += n % 10;
n /= 10;
}
cout << a;
return 0;
}
2020-09-22 15:59:24
import math
n = input()
n = float(n)
if n <=100 :
b = int(n / 100)
c = int(n%100/10)
d = n % 10
total = b + c + d
print(int(total))
else :
print()
2020-01-13 16:52:05
hehe
2013-10-21 15:55:49 Iderbat
ene bodolt bolohq bhiin
#include<stdio.h>
#include<conio.h>
int main(){
int a,b,s,n;
scanf("%d",&n);
if(n<=100)
a=n/10;
b=n%10;
s=a+b;
printf("%d",s);
getch();
return 0;
}
2013-04-21 09:28:23 buyandalai byambaa
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
main(){
int n,s,m ;
scanf("%d", &n);
if (n==100) s=1;
else
{
s=0, m=n;
while(n>0)
{
s=s+n%10;
n=n/10;
}
}
printf("%d", s);
system("pause");
return 0;
}

2013-02-22 14:43:30 up24
#include <stdio.h>
int n,a;
int main()
{
scanf("%d",&n);
a=0;
while (n>0)
{
a=a+n%10;
n=n/10;
}
printf("%d", a);
for(;;);
return 0;
}
xexe
2013-02-06 06:42:31 M.Enkhbileg
Problem in C++ !!!
#include <iostream>
#include <stdlib.h>
using namespace std;
main()
{
int b=0, n, i, s=0;
cin >> n;
b = n%10;
while(n!=0){
n/=10; s=s+n; i=s%10;
}
cout << b+i;
system("PAUSE");
return 0;
}



Last edit: 2013-02-06 06:43:20
2012-10-22 15:48:43 Tso .
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
main(){
int n;
scanf("%d", &n);
s=0;
while(n>0){
s=s+n%10;
n=n/10;
}
printf("%d", s);
system("pause");
return 0;
}

(getch ashiglahaar aldaa zaadag ym bn)
ene zovhon oruulsan n toog hevledeg ym bna..,niilber bish ym bn.
2011-09-11 11:41:55 hw10d208
#include <stdio.h>
#include <stdlib.h>
main(){
int n,m,p;
m=0;
scanf("%d",&n);
while(n!=0){
p=n;
m=m+p%10;
n=n/10;
}
printf("%d",m);
system("PAUSE");
return 0;
}

2011-01-01 10:59:37 dsn
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
main(){
int n;
scanf("%d", &n);
int s=0, m=n;
while(n>0){
s=s+n%10;
n=n/10;
}
printf("%d", s);
system("pause");
return 0;
} zuvzuv
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.