First and Last Digit | Problem - 42 | Beginner level | C language | CodeChef

 Link to the problem statement: https://www.codechef.com/submit/FLOW004

Solution: 

The solution is already given, you just have to click on SUBMIT CODE button.

//We have populated the solutions for the 10 easiest problems for your support.
//Click on the SUBMIT button to make a submission to this problem.

#include <stdio.h>

int main()
{
    int ld,n,t,r;
    
    scanf("%d",&t);
    while(t--){
        scanf("%d",&n);
        ld = n%10;
        while(n>0) {r=n%10; n/=10;}
        printf("%d\n",r+ld);
    }
    return 0;
}

Hope this will help you, if you want anything else leave a comment.

Thank you 

Comments

Popular posts from this blog

My very 1st contest! | Problem - 1 | Beginner level | C language | CodeChef

Implementing linked list in C language

Score High | Problem - 4 | Beginner level | C language | CodeChef