#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int a,b,c;
string s;
cin>>a>>b;
c=a-b;
if(c%10==9){
c=c-1;
}else{
c=c+1;
}
cout<<c;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int a,b,c;
string s;
cin>>a>>b;
c=a-b;
if(c%10==9){
c=c-1;
}else{
c=c+1;
}
cout<<c;
return 0;
}
i am newbie how can go ahead which problem should i choose.
@jainkarmesh
Try to Run this code
#include < iostream >
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
int m=a-b;
int ch=m%10;
m=m/10;
for(int i=0;i<10;i++)
{
if(ch==i) continue;
else { m=m*10+i;break;}
}
cout<<m; return 0;
}
@vardhman811 Start with some video course of DSA you can find many of them on telegram along side solve DSA learning series provided by codechef.
//simplest sol.
int main(void) {
int a,b;string k;
cin>>a;cin>>b;
n=a-b;
k=to_string(n);
if(k[0]==‘1’){k[0]=‘9’;}
else{k[0]=k[0]-1;}
cout<<k;
}
void doTestCase(){
// TODO: Testcase
USInt A, B; std::cin >> A >> B;
USInt ans_c = A - B;
if(ans_c%10==9) ans_c -= 1;
else ans_c +=1;
std::cout << ans_c << std::endl;
}