write a program to initialize long data type and print the sum of only last two digit
Answers
Answered by
0
Answer:
#include <iostream>
using namespace std;
int main()
{
long sal;
cout<<"Enter a number ";
cin>>sal;
int sum=sal%10 +(sal/10)%10;
cout<<"Sum of last two digits is "<<sum;
return 0;
}
Explanation:
Just use the logic
we can find last digit by finding remainder on dividing by 10
and so on..
Hope it helps :-)
Mark it brainliest
Similar questions