Thursday, July 4, 2019

Addition of Two Numbers Using Structures in C

Design a program using structure and function to accept two numbers and then the program will display the total sum of the two numbers on the screen using C programming language.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com




Sample Program Output


Program Listing

/*add.c
 Author    : Mr. Jake Rodriguez Pomperada,BSCS,MAED-IT
 Date      : December 1, 2018  Saturday 7:41 PM
 Location  : Bacolod City, Negros Occidental
 Website   : http://www.jakerpomperada.com
 Emails    : jakerpomperada@jakerpomperada.com
             jakerpomperada@gmail.com
             jakerpomperada@yahoo.com
             jakerpomperada@aol.com
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

struct add {
  int value1,value2;
    int addition()
    {
        return(value1+value2);
    }
};

int main() {
    add math;
    char reply;
do {
    printf("\n\n");
    printf("\t\t");
    printf("\n\n");
    printf("\tEnter the first value  : ");
    scanf("%d",&math.value1);
    printf("\n");
    printf("\tEnter the second value : ");
    scanf("%d",&math.value2);
    printf("\n\n");
    printf("\tThe sum of %d and %d is %d."
,math.value1,math.value2, math.addition());
printf("\n\n");
    printf("\tDo you want to continue y/n? : ");
    scanf("%s",&reply);
    if (toupper(reply) == 'N') {
     printf("\n\n");
     printf("\tThank You For Using This Software !!!");
     break;
    }
    } while (toupper(reply!='Y'));
    printf("\n\n");
printf("\t\tEnd of Program");
printf("\n\n");
system("pause");
}










No comments:

Post a Comment