All pastes #344813 Raw Edit

Drews C

public c v1 · immutable
·published 2007-02-08 01:03 UTC
rendered paste body
/* These are includes */#include <stdio.h>/* This is the main function */int main(void){	/* You guessed it, more declarations */	int choice=0;	int in0=0;	int in1=0;	/* Clear the screen and show the options */	system("CLS");	printf("What do you want to do?");	printf("\n1) Add\n2) Subtract\n");	printf("3) Multiply\n4) Divide\n");	printf("What is your choice? ");	/* Prompts for input */	scanf("%d", &choice);	printf("\n\n");	if(choice!=1 && choice!=2 && choice!=3 && choice!=4){		/* If the choice is invalid, tell the user */		printf("Not a valid choice!");	}	else{		/* If the choice is valid, prompt for input and		   perform the calculation                      */		printf("What are the two numbers?\nFirst number? ");		scanf("%d", &in0);		printf("Second number? ");		scanf("%d", &in1);			if(choice==1){			printf("\n\nThe answer is %d", in0+in1);		}		if(choice==2){			printf("\n\nThe answer is %d", in0-in1);		}		if(choice==3){			printf("\n\nThe answer is %d", in0*in1);		}		if(choice==4){			printf("\n\nThe answer is %d", in0/in1);		}	}}