# newbie :P

This is a discussion on newbie :P within the C++ Programming forums, part of the General Programming Boards category; This is the task: Given two positive integers m and n. Determine the number m n last digit sum. Sharing ...

1. ## newbie :P

This is the task: Given two positive integers m and n. Determine the number m n last digit sum. Sharing the figure should be quantified.

Code:
```#include <iostream>
using namespace std;
int main ()
{
int   m,n,k,j=0,sum2=0,sum,sum1=0,z;

cout<<"ievadiet skaitli M: \n";
cin>>m;

cout<<"ievadiet skaitli N: \n";
cin >>n;

for (int  i=0; i<=n; i++)
{
sum=m%10;

sum1=sum1+sum;

do
{
m=m-10;
j++;
m=j;
}
while (m>=10);

//m=m/10;

}

cout<<sum1<<endl;

system("pause");
return 0;
}```

Why this program is not the same with it :

Code:
```#include <iostream>
using namespace std;
int main ()
{
int   m,n,k,j=0,sum2=0,sum,sum1=0;

cout<<"ievadiet skaitli M: \n";
cin>>m;

cout<<"ievadiet skaitli N: \n";
cin >>n;

for (int  i=0; i<=n; i++)
{
sum=m%10;

sum1=sum1+sum;

m=m/10;

}

cout<<sum1<<endl;

system("pause");
return 0;
}```

Popular pages Recent additions