Sum of first & fourth digit of a four digit number

/* write a program to find the Sum of first & fourth digit of a four digit number*/

#include<stdio.h>
#include<conio.h>
void main()
{
int n ,x,d1,d2,d3,d4,s;
clrscr();
printf("\n Enter four digit number ");
scanf("%d ",&n);
d1 = n % 10 ;
n = n / 10 ;
d2 = d % 10 ;
n = n / 10 ;
d3 = n % 10 ;
n = n / 10 ;
d4 = n % 10 ;
s d1 + d4 ;
printf("\n The sum of first & last digit of %d = %d", x, s);
getch();

}

Who's online

We have 19 guests and no members online

About Us

Harsimran Singh

Hello

This website is a special gift for Programming Lovers , which want to learn basic Programming Languages and want to develop there skills Read More....

Our work

Find Us

This email address is being protected from spambots. You need JavaScript enabled to view it.

Harsimran Singh(Facebook)

Harsimran Singh(about.me)

Harsimran Singh(G+)