Funky Little C Calculator

int main() {
int num1, num2;
char ch;
printf("Enter Two numbers:n");
scanf("%d %d",&num1,&num2);
printf("Function:a to add | s to subtract | m to multiply | d to divide \n");
ch = getch();
if(ch == 'a') printf("The sum is: %d", num1+num2);
if(ch == 's') printf("The subtraction result is: %d", num1-num2);
if(ch == 'm') printf("The multiplied value is: %d", num1*num2);
if(ch == 'd') printf("The result is: %d", num1/num2);
printf("\n \n \n");
}

This entry was posted in Blog Post and tagged . Bookmark the permalink.

2 Responses to Funky Little C Calculator

  1. Romel says:

    Just completed the course “Computer programming and Database management”…did the same thing in an assignment and do not like C anymore.
    Good post just to pass time.
    Carry on.

  2. maSnun says:

    I don’t like C any more as well.
    I love Python and PHP.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">