Y'all Check out my basic arithmetic Calculator And tell me what y'all Think

0 Divulger Michealson · August 5, 2015
Just a basic thing actually. Nothing too fancy

#include <stdio.h>
#include <stdlib.h>
/* Program Name: Basic Calculator

    Developer: Mike Divulger

    This program Calculates simple Arithmetic Functions

    in a batch*/

int main()
{
    int x;
    int y;
    int z;
    int u;
    int i;
    int k;
    char b[20];
    int r =1;
    char Ans;
    char Ans2;

    for(i=0; i<=25; i++){
        printf("This Is A Calculator Do you Want to Do operations('Yes Or No').\n\n");
        scanf(" %c", &Ans);
        if( (Ans=='Yes')||(Ans=='yes')||(Ans=='Y')||(Ans=='y') ){
            printf("Do you want to do Two Number calculation or More or Q to quit (T/M/Q)\n");
            scanf(" %c",&Ans2);
            for(k=26; k>=26; k++){
                    if( (Ans2=='T')||(Ans2=='t')||(Ans2=='two')||(Ans2=='Two') ){
                   printf("Enter The NUmbers You want to Calculate Below\n\n");
            scanf(" %i",&y);
            scanf(" %i",&z);
            printf("The value of %i + %i = %i\n", y,z, y + z);
            printf("The value of %i / %i = %i\n", y, z, y / z );
            printf("The value of %i - %i = %i\n", y,z,y - z);
            printf("The value of %i * %i = %i\n", y,z, y * z );
            printf("The value of %i @ %i = %i\n\n", y,z, y % z );


            }
            else if( (Ans2=='M')||(Ans2=='m')||(Ans2=='More')||(Ans2=='more') ){
            printf("Enter The NUmbers You want to Calculate Below\n\n");
            scanf(" %i",&y);
            scanf(" %i",&z);
            scanf(" %i",&u);
            scanf(" %i",&x);
            printf("The value of %i + %i + %i + %i = %i\n", y,z,u,x, y + z + x + u);
            printf("The value of %i / %i / %i / %i = %i\n", y, z,u,x, y / z / x / u);
            printf("The value of %i - %i - %i - %i = %i\n", y,z,u,x, abs(y) - abs(z) - abs(x) - abs(u));
            printf("The value of (raw input) %i - %i - %i - %i = %i\n", y,z,u,x, y - z - x - u);
            printf("The value of %i * %i * %i * %i * %i = %i\n", y,z,u,x,r, y * z * x * u * r);
            printf("The value of %i @ %i @ %i @ %i = %i\n\n", y,z,u,x, y % z % x % u);

            }else if( (Ans2=='Q')||(Ans2=='q') ){
                break;

            }else{
                printf("Enter Your Name Below\n");
            scanf(" %s", &b);
            printf("Mr./Mrs./Ms. %s This Is An Invalid Response Please input (Y/N).\n\n\a", b);
            break;

            }
}

        }else if( (Ans=='No')||(Ans=='no')||(Ans=='n')||(Ans=='N') ){
            printf("Enter Your Name Below\n");
            scanf(" %s", &b);
            printf("%s Thank You For Using This Program GoodBye.", b);
            break;

        }else{
            printf("Enter Your Name Below\n");
            scanf(" %s", &b);
            printf("Are You Male or Female Enter (F/M) Below\n");
            scanf(" %c",&Ans);
            if( (Ans=='f')||(Ans=='F') ){
            printf("Ms. %s This Is An Invalid Response Please input (Y/N).\n\n\a", b);

            }else if( (Ans=='M')||(Ans=='m') ){
            printf("Mr. %s This Is An Invalid Response Please input (Y/N).\n\n\a", b);

            }else{
                printf("Invalid Response!!!");

            }

        }


    }
    return 0;
}

Post a Reply

Replies

Oldest  Newest  Rating
0 Rich Sharma · August 18, 2015
one thing you can do to make it a little better is you can ask the user how much numbers to put it. then make a while loop or for loop, i < number inputed. then scan the integers the user entered and have an integer called sum and sum += whatever the user inputed. this way you could make your program a little more dynamic, even if the user still has to enter how much integers he/she
wants to add, subtract, multiply, divide, etc.
0 Divulger Michealson · August 18, 2015
iight i'll try that out as soon as possible. thats for checking it 
tho
0 Gabriel James · August 18, 2015
What program did u use to create dis
0 Divulger Michealson · August 18, 2015
code blocks its the only piece of software i understand
 
  • 1

C

107,111 followers
About

One of the most popular languages of all time.

Links
Moderators
Bucky Roberts Administrator