• Source
    1. #include<stdio.h>
    2. #include<stdlib.h>
    3. int sum(); /* function declaration */
    4. main() /* main function */
    5. {
    6. int choice;
    7. printf("**********WELCOME**********\n\n");
    8. printf("Please, select your choice.\n");
    9. printf("1.Addition(press 1, for addition)\n2.Exit(press 2,for quit)\n\n");
    10. printf("Please, Enter your choice : ");
    11. scanf("%d",&choice);
    12. if(choice==1)
    13. sum(); /* function call */
    14. if(choice==2)
    15. exit(0);
    16. } /* end of main() function */
    17. /* function structure */
    18. int sum(){
    19. int num1,num2,result;
    20. printf("\nYou have selected addition option.\nPlease, Enter the 1st number : ");
    21. scanf("%d",&num1);
    22. printf("\nPlease, Enter the second number : ");
    23. scanf("%d",&num2);
    24. result=num1+num2;
    25. printf("\nThe result is : %d + %d = %d",num1,num2,result);
    26. }
    27.