Wednesday, 21 January 2015

A Game With Numbers, Code:NGM

It is a simple math problem. Take two or three examples and try.


Solution:
//headers.
#include<iostream>

using namespace std;

int main()
{
long long T,c;  // "c" used to hold last digit of given number
cin>>T;
c = T%10;
if(c == 0)
cout<<"2"<<endl;
else
cout<<"1"<<endl<<c<<endl;
return 0;
}

No comments:

Post a Comment