Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

ilahma / iax0583

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Commit 8fff08e2 authored 6 years ago by ilahma's avatar ilahma
Browse files
Options
  • Browse Files
  • Download
  • Email Patches
  • Plain Diff

Upload New File

parent fbe52946 master
Hide whitespace changes
Inline Side-by-side
Showing with 74 additions and 0 deletions
  • switch.c
switch.c 0 → 100644
View file @ 8fff08e2
#include <stdio.h>
int add(int a,int b);
int subtract(int a,int b);
int multiplication(int a,int b);
int division(int a,int b);
int main () {
int a;
int b;
char operator;
printf("Enter two numbers:\n");
scanf("%d %d",&a, &b);
printf("Please, enter an operator: +,-,*,: \n");
scanf(" %c", &operator);
switch(operator)
{
case '+':
printf("%d + %d = %d",a,b,add(a,b));
break;
case '-':
printf("%d - %d = %d",a,b,subtract(a,b));
break;
case '*':
printf("%d * %d = %d",a,b,multiplication(a,b));
break;
case '/':
printf("%d / %d = %d",a,b,division(a,b));
break;
default:
printf("Operator is not correct");
}
return 0;
}
int add(int a,int b)
{
return a+b;
}
int subtract(int a,int b)
{
return a-b;
}
int multiplication(int a,int b)
{
return a*b;
}
int division(int a,int b)
{
return a/b;
}
This diff is collapsed. Click to expand it.
  • Write
  • Preview
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment