Friday, 13 July 2018

The Sum of first and last digits of 4 digit number

===========================================================================
                                CODING



#include<conio.h>
#include<iostream.h>
#include<math.h>

void main()
{
clrscr();

int b,c,d,e;
long a,q;
cout<<"Enter any four digit number:- ";
cin>>a;
b=a%10;
a=a/10;
c=a%10;
a=a/10;
d=a%10;
a=a/10;
e=a%10;
q=b+e;
cout<<"\n The sum of first and last number is:- "<<q;

getch();
}


===========================================================================


                                OUTPUT


No comments:

Post a Comment