/*Sum of First and Last Digit of a Number*/
#include<stdio.h>
#include<conio.h>
void main()
{
int num,sum=0,a,b;
printf("\n Sum of First and Last Digit of a four Digits Number");
printf("\n Enter A Number ::");
scanf("%d",&num);
a=num%10;
b=num/1000;
sum=a+b;
printf("\n First Number is :: %d",b);
printf("\n Last Number is :: %d",a);
printf("\n Sum : %d",sum);
printf("\n Want More Need Example for Practice ");
printf("\n Logon www.Code2Create.com");
getch();
}
If you want to add first and last digit number then
b=num/n
- For 2 digits Number (n=10)
- For 3 digits Number (n=100)
- For 4 digits Number (n=1000)
0 comments:
Post a Comment