How to write a C Program to Sum of The First and Last Digit Of 'n' Digit Number in C Programming Language ?
- int main()
- {
- int num,len,last;
- printf("\nEnter n digit number \n");
- scanf("%d",&num);
- last=num%10;
- while(num>0)
- {
- num=num/10;
- len=len+1;
- }
- num=num/(pow(10,len-1));
- num=num%10;
- printf("the result is %d",last+num);
- getch();
- return 0;
- }