Pagini recente » Monitorul de evaluare | Cod sursa (job #2055294) | Cod sursa (job #423033) | Cod sursa (job #1365612) | Cod sursa (job #1928857)
#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
bool isdigit(char c){
if (c-48>9 || c-48<0)
return 0;
return 1;
}
int nrcif (int n){
int z=0;
while (n){
z++;
n=n/10;
}
return z;
}
int main()
{
ifstream fin ("suma.in");
ofstream fout ("suma.out");
char c;
int x,r,r2=0;
scanf ("%c", &c);
r = 0;
while (isdigit(c))
{
x=c;
r=r*10+x-'0';
scanf ("%c", &c);
}
scanf ("%c", &c);
while (isdigit(c))
{
x=c;
r2=r2*10+x-'0';
scanf ("%c", &c);
}
int n=r+r2;
int i, z, cif;
z=nrcif(n);
char kk;
for (i=1;i<=z;i++){
cif=(n/(int)pow(10,z-i))%10;
kk=cif+'0';
cout<<kk;
}
return 0;
}