About Me

About Me : I have been working as a Software Engineer for various international companies for four years.Currently, I am working as a full stack Javascript developer in Petronas(Malaysia).

Skills

Skills • Javascript •Typescript •Python •C •Java •ReactJs • Redux • VueJs • NestJs • React Testing Library • Django• PostgreSQL • MySQL • NodeJs • Git • Docker • Jira • Visual Studio Code • Slack

সোমবার, ১২ জানুয়ারী, ২০১৫

SPOJ SOLUTION :42. Adding Reversed Numbers

#include<bits/stdc++.h>

using namespace std;

int main()
{

    int test;
    char a[100],b[100],c[100],d[100],q[100],r[100];
    cin>>test;
    while(test--)
    {

        scanf("%s%s",a,b);
        int l1=strlen(a);
        int l2=strlen(b);
        int k=0;
        for(int i=l1-1; i>=0; i--) c[k++]=a[i];
        c[k++]='\0';
        k=0;
        for(int i=l2-1; i>=0; i--) d[k++]=b[i];
        d[k++]='\0';

        int x=atoi(c);
        int y=atoi(d);
       // cout<<x<<y<<endl;
        int res=x+y;
        //cout<<res<<endl;
        sprintf(q,"%d",res);
        int len=strlen(q);
        k=0;
        for(int i=len-1;i>=0;i--) r[k++]=q[i];
        r[k++]='\0';
        cout<<atoi(r)<<endl;


    }


    return 0;
}

কোন মন্তব্য নেই:

একটি মন্তব্য পোস্ট করুন