Showing posts with label SUM OF FIRST AND LAST NUMBER PROGRAM IN C. Show all posts
Showing posts with label SUM OF FIRST AND LAST NUMBER PROGRAM IN C. Show all posts

Saturday, June 4, 2016

Sum of First and Last Number in C

A simple program that will ask the user three integer number and then our program will find the sum of the first and the last number.

 Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360



Sample Program Output


Program Listing

#include <stdio.h>
#include <stdlib.h>

int number=0,first=0,last=0, sum=0;

int main()
{
    system("cls");
    printf("\t SUM OF FIRST AND LAST NUMBER PROGRAM");
    printf("\n\n");
    printf("Give a three digit number : ");
    scanf("%d",&number);

    first = (number/100);
    last = (number%10);

    printf("\n");
    printf("Display Results");
    printf("\n");
    printf("\nThe First Number is %d.",first);
    printf("\nThe Last Number is %d.",last);
    sum = (first+last);
    printf("\n\n");
    printf("The sum of digits is %d.",sum);
    printf("\n\n");
    printf("End of Program");
    printf("\n\n");
    system("pause");
}