SlideShare a Scribd company logo
1 of 5
Switch

#include<stdio.h>

#include<conio.h>

#include<stdlib.h>

main ()

{

    printf("Nisarat Kramsri     No.16        M.6/1nn");

Nisarat Kramsri         No.16        M.6/1

       int choice;

       float num1,num2;                  num1,num2

       printf("Please select choicen");

       printf("1.Program additionn");

       printf("2.Program substractionn");

       printf("3.Exit programn");

       scanf("%d",&choice);
switch(choice)                switch

   case 3:exit(3);

   printf("Enter number1: ");

   scanf("%f",&num1);

   printf("Enter number2: ");

   scanf("%f",&num2);

   switch(choice)               switch

   {

   case 1:

printf("%.2f+%.2f=%.2fn",num1,num2,num1+num2);break;




   case 2: printf("%.2f-%.2f=%.2fn",num1,num2,num1-
num2);break;



   }

   getch();
}
Flowchart




              nisarat kramsri
            No.16 M.




                   Choice




    yes
              Choice=3


                       no




Choice=1                        Choice=2



Num1+num2                       Num1-num2

More Related Content

Viewers also liked

คำสั่ง For
คำสั่ง Forคำสั่ง For
คำสั่ง Forkramsri
 
Sample template to report internet dns's performance
Sample template to report internet dns's performanceSample template to report internet dns's performance
Sample template to report internet dns's performanceMustafa Golam
 
งานนำเสนอ1
งานนำเสนอ1งานนำเสนอ1
งานนำเสนอ1kramsri
 
Grand strategi agar koperasi1
Grand strategi agar koperasi1Grand strategi agar koperasi1
Grand strategi agar koperasi1Irna Indriani
 
accreditation 2
 accreditation 2 accreditation 2
accreditation 2Tota Essam
 
Linear day 17
Linear day 17Linear day 17
Linear day 17cirilah
 
คำสั่ง Do while
คำสั่ง Do whileคำสั่ง Do while
คำสั่ง Do whilekramsri
 
คำสั่ง Switch.2
คำสั่ง Switch.2คำสั่ง Switch.2
คำสั่ง Switch.2kramsri
 
คำสั่ง Do while
คำสั่ง Do whileคำสั่ง Do while
คำสั่ง Do whilekramsri
 
GPRS/EDGE Basics / knowledge sharing
GPRS/EDGE Basics /  knowledge sharingGPRS/EDGE Basics /  knowledge sharing
GPRS/EDGE Basics / knowledge sharingMustafa Golam
 
Aula3 sistemas lineares - parte1
Aula3   sistemas lineares - parte1Aula3   sistemas lineares - parte1
Aula3 sistemas lineares - parte1rafamaco
 
Treliça inclinada-pronto11
 Treliça inclinada-pronto11 Treliça inclinada-pronto11
Treliça inclinada-pronto11Fer Nando
 

Viewers also liked (14)

คำสั่ง For
คำสั่ง Forคำสั่ง For
คำสั่ง For
 
Sample template to report internet dns's performance
Sample template to report internet dns's performanceSample template to report internet dns's performance
Sample template to report internet dns's performance
 
งานนำเสนอ1
งานนำเสนอ1งานนำเสนอ1
งานนำเสนอ1
 
Grand strategi agar koperasi1
Grand strategi agar koperasi1Grand strategi agar koperasi1
Grand strategi agar koperasi1
 
Ekonomi koperasi
Ekonomi koperasiEkonomi koperasi
Ekonomi koperasi
 
accreditation 2
 accreditation 2 accreditation 2
accreditation 2
 
Curiosites 11
Curiosites 11Curiosites 11
Curiosites 11
 
Linear day 17
Linear day 17Linear day 17
Linear day 17
 
คำสั่ง Do while
คำสั่ง Do whileคำสั่ง Do while
คำสั่ง Do while
 
คำสั่ง Switch.2
คำสั่ง Switch.2คำสั่ง Switch.2
คำสั่ง Switch.2
 
คำสั่ง Do while
คำสั่ง Do whileคำสั่ง Do while
คำสั่ง Do while
 
GPRS/EDGE Basics / knowledge sharing
GPRS/EDGE Basics /  knowledge sharingGPRS/EDGE Basics /  knowledge sharing
GPRS/EDGE Basics / knowledge sharing
 
Aula3 sistemas lineares - parte1
Aula3   sistemas lineares - parte1Aula3   sistemas lineares - parte1
Aula3 sistemas lineares - parte1
 
Treliça inclinada-pronto11
 Treliça inclinada-pronto11 Treliça inclinada-pronto11
Treliça inclinada-pronto11
 

Similar to C program switch case calculator

ตัวอย่างการเขียนโปรแกรม โดยใช้ฟังก์ชัน
ตัวอย่างการเขียนโปรแกรม โดยใช้ฟังก์ชันตัวอย่างการเขียนโปรแกรม โดยใช้ฟังก์ชัน
ตัวอย่างการเขียนโปรแกรม โดยใช้ฟังก์ชันWarawut
 
Numerical Methods in C
Numerical Methods in CNumerical Methods in C
Numerical Methods in CAmbili Baby
 
ภาษาซี
ภาษาซีภาษาซี
ภาษาซีkramsri
 
SIMPLE C PROGRAMS - SARASWATHI RAMALINGAM
SIMPLE C PROGRAMS - SARASWATHI RAMALINGAMSIMPLE C PROGRAMS - SARASWATHI RAMALINGAM
SIMPLE C PROGRAMS - SARASWATHI RAMALINGAMSaraswathiRamalingam
 
Chapter 5 Balagurusamy Programming ANSI in c
Chapter 5 Balagurusamy Programming ANSI  in cChapter 5 Balagurusamy Programming ANSI  in c
Chapter 5 Balagurusamy Programming ANSI in cBUBT
 
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...DR B.Surendiran .
 
1. Translation program#includestdio.h#includeconio.h#incl.pdf
1. Translation program#includestdio.h#includeconio.h#incl.pdf1. Translation program#includestdio.h#includeconio.h#incl.pdf
1. Translation program#includestdio.h#includeconio.h#incl.pdfsutharbharat59
 
C programs
C programsC programs
C programsMinu S
 
Practical File of C Language
Practical File of C LanguagePractical File of C Language
Practical File of C LanguageRAJWANT KAUR
 
Incorporate the SOR method in the multigridTest-m and apply the multig.pdf
Incorporate the SOR method in the multigridTest-m and apply the multig.pdfIncorporate the SOR method in the multigridTest-m and apply the multig.pdf
Incorporate the SOR method in the multigridTest-m and apply the multig.pdfaartechindia
 

Similar to C program switch case calculator (20)

ตัวอย่างการเขียนโปรแกรม โดยใช้ฟังก์ชัน
ตัวอย่างการเขียนโปรแกรม โดยใช้ฟังก์ชันตัวอย่างการเขียนโปรแกรม โดยใช้ฟังก์ชัน
ตัวอย่างการเขียนโปรแกรม โดยใช้ฟังก์ชัน
 
C Programming Example
C Programming Example C Programming Example
C Programming Example
 
Numerical Methods in C
Numerical Methods in CNumerical Methods in C
Numerical Methods in C
 
C programs
C programsC programs
C programs
 
ภาษาซี
ภาษาซีภาษาซี
ภาษาซี
 
บทที่ 3
บทที่ 3บทที่ 3
บทที่ 3
 
CP Handout#6
CP Handout#6CP Handout#6
CP Handout#6
 
Progr3
Progr3Progr3
Progr3
 
C lab manaual
C lab manaualC lab manaual
C lab manaual
 
SIMPLE C PROGRAMS - SARASWATHI RAMALINGAM
SIMPLE C PROGRAMS - SARASWATHI RAMALINGAMSIMPLE C PROGRAMS - SARASWATHI RAMALINGAM
SIMPLE C PROGRAMS - SARASWATHI RAMALINGAM
 
Chapter 5 Balagurusamy Programming ANSI in c
Chapter 5 Balagurusamy Programming ANSI  in cChapter 5 Balagurusamy Programming ANSI  in c
Chapter 5 Balagurusamy Programming ANSI in c
 
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
 
1. Translation program#includestdio.h#includeconio.h#incl.pdf
1. Translation program#includestdio.h#includeconio.h#incl.pdf1. Translation program#includestdio.h#includeconio.h#incl.pdf
1. Translation program#includestdio.h#includeconio.h#incl.pdf
 
SaraPIC
SaraPICSaraPIC
SaraPIC
 
C programs
C programsC programs
C programs
 
cpract.docx
cpract.docxcpract.docx
cpract.docx
 
Practical File of C Language
Practical File of C LanguagePractical File of C Language
Practical File of C Language
 
Incorporate the SOR method in the multigridTest-m and apply the multig.pdf
Incorporate the SOR method in the multigridTest-m and apply the multig.pdfIncorporate the SOR method in the multigridTest-m and apply the multig.pdf
Incorporate the SOR method in the multigridTest-m and apply the multig.pdf
 
7 functions
7  functions7  functions
7 functions
 
C Programming Exam problems & Solution by sazzad hossain
C Programming Exam problems & Solution by sazzad hossainC Programming Exam problems & Solution by sazzad hossain
C Programming Exam problems & Solution by sazzad hossain
 

More from kramsri

ข อสอบคอม 5 ข อส่ง
ข อสอบคอม 5 ข อส่งข อสอบคอม 5 ข อส่ง
ข อสอบคอม 5 ข อส่งkramsri
 
ข อสอบคอม #6
ข อสอบคอม #6ข อสอบคอม #6
ข อสอบคอม #6kramsri
 
คำสั่ง Switch
คำสั่ง Switchคำสั่ง Switch
คำสั่ง Switchkramsri
 
ประเม นรายงาน กล _มท__ 2 คำส__งควบค_มข__นพ__นฐานภาษาซ_ (1)
ประเม นรายงาน กล _มท__ 2 คำส__งควบค_มข__นพ__นฐานภาษาซ_ (1)ประเม นรายงาน กล _มท__ 2 คำส__งควบค_มข__นพ__นฐานภาษาซ_ (1)
ประเม นรายงาน กล _มท__ 2 คำส__งควบค_มข__นพ__นฐานภาษาซ_ (1)kramsri
 
ประเม นรายงาน กล _มท__ 2 คำส__งควบค_มข__นพ__นฐานภาษาซ_
ประเม นรายงาน กล _มท__ 2 คำส__งควบค_มข__นพ__นฐานภาษาซ_ประเม นรายงาน กล _มท__ 2 คำส__งควบค_มข__นพ__นฐานภาษาซ_
ประเม นรายงาน กล _มท__ 2 คำส__งควบค_มข__นพ__นฐานภาษาซ_kramsri
 
ความคิดเห็นเพื่อน(แบบประเมิน)
ความคิดเห็นเพื่อน(แบบประเมิน)ความคิดเห็นเพื่อน(แบบประเมิน)
ความคิดเห็นเพื่อน(แบบประเมิน)kramsri
 
ประกวดภาพถ่าย
ประกวดภาพถ่ายประกวดภาพถ่าย
ประกวดภาพถ่ายkramsri
 

More from kramsri (7)

ข อสอบคอม 5 ข อส่ง
ข อสอบคอม 5 ข อส่งข อสอบคอม 5 ข อส่ง
ข อสอบคอม 5 ข อส่ง
 
ข อสอบคอม #6
ข อสอบคอม #6ข อสอบคอม #6
ข อสอบคอม #6
 
คำสั่ง Switch
คำสั่ง Switchคำสั่ง Switch
คำสั่ง Switch
 
ประเม นรายงาน กล _มท__ 2 คำส__งควบค_มข__นพ__นฐานภาษาซ_ (1)
ประเม นรายงาน กล _มท__ 2 คำส__งควบค_มข__นพ__นฐานภาษาซ_ (1)ประเม นรายงาน กล _มท__ 2 คำส__งควบค_มข__นพ__นฐานภาษาซ_ (1)
ประเม นรายงาน กล _มท__ 2 คำส__งควบค_มข__นพ__นฐานภาษาซ_ (1)
 
ประเม นรายงาน กล _มท__ 2 คำส__งควบค_มข__นพ__นฐานภาษาซ_
ประเม นรายงาน กล _มท__ 2 คำส__งควบค_มข__นพ__นฐานภาษาซ_ประเม นรายงาน กล _มท__ 2 คำส__งควบค_มข__นพ__นฐานภาษาซ_
ประเม นรายงาน กล _มท__ 2 คำส__งควบค_มข__นพ__นฐานภาษาซ_
 
ความคิดเห็นเพื่อน(แบบประเมิน)
ความคิดเห็นเพื่อน(แบบประเมิน)ความคิดเห็นเพื่อน(แบบประเมิน)
ความคิดเห็นเพื่อน(แบบประเมิน)
 
ประกวดภาพถ่าย
ประกวดภาพถ่ายประกวดภาพถ่าย
ประกวดภาพถ่าย
 

C program switch case calculator

  • 1. Switch #include<stdio.h> #include<conio.h> #include<stdlib.h> main () { printf("Nisarat Kramsri No.16 M.6/1nn"); Nisarat Kramsri No.16 M.6/1 int choice; float num1,num2; num1,num2 printf("Please select choicen"); printf("1.Program additionn"); printf("2.Program substractionn"); printf("3.Exit programn"); scanf("%d",&choice);
  • 2. switch(choice) switch case 3:exit(3); printf("Enter number1: "); scanf("%f",&num1); printf("Enter number2: "); scanf("%f",&num2); switch(choice) switch { case 1: printf("%.2f+%.2f=%.2fn",num1,num2,num1+num2);break; case 2: printf("%.2f-%.2f=%.2fn",num1,num2,num1- num2);break; } getch();
  • 3. }
  • 4.
  • 5. Flowchart nisarat kramsri No.16 M. Choice yes Choice=3 no Choice=1 Choice=2 Num1+num2 Num1-num2