SlideShare a Scribd company logo
1.
 1.1                 Increment Operator

       4.1


       ++     increment            1



                      b=3 ;
         a=b ++

          1                    2          a=b;
        a=3
                              b=b+1;
b=3+1
b=3 ;
            a=++b
                1.                           2             b=b
+1;                  b=3+1
                                      a=b;               a=4
      2.              a        4      b          4

           --             decrement                  1


1.2                                decrement operator

      4.2
b=3        a=b - -

          1.                 2
a=b;           a=3
                         b=b-1;
        b=3-1
      2.      a      3   b       2
           a= - -b




          1.                 2
1.3
          (compound assignment
operators) 4.3
1.4
a = b ++ ;
      2
          a=b;                b       a
a=4
          a=b+1 ;       4+1       5
          b   b=5
             b = ++ a ;
          a=a+1;          a       4   4+1
1.5



                           implicit type
conversion




explicit type conversion
4.3
4.3                           4.3
1.                    result 1 = value1 + value 2 ;
                   10 + 3.17      13.17
result 1


2.                   result 1 = value / 3 ;

                                    /
           % .2f
2                               for
                        :



3

                    :                   for
      For (        =                ;   ;
2.1                )
      {
for           statemmnt       (s)   ;
      }                 for


              :     1
4.1             for

2.2         for

                  5
4.4
      for
1.               5

2.                        n
          1
3.            n   6

4.
2.3     for




        4.5
      for
4.5
4.5


1

2.      3   3
3.
3.
 while
                 :


         while




         {}      while

                 {}      while
while
         while


     >
{}
3.2           while




      while
Ctrl-
Break

             n <= 5
        n   n
while




          while
          while
n <= 5

                  n = n+1 ;
while



        n



while           n
n
num
do-while
do – while
             do – while




                          do – whil
do – while




do – while
{
}

      while n <= 5

n>5
           n++ :      n=n +1:
            n        n>5
{
}




    do – while
do – while   n
•        for
•        while
•        do-
    while
For
for

      2



          3   for
n




key loop =>……………
Report Score
****************************
No. => ……………
name is =>    …………..
midterm is => …………..
Final is =>   ……………
* Score =     ……………
*****************************
*Average Score is = ………….
*****************************
1.
     1.1


     1.2
           =   1
           =

           =

           =


     1.3
1.5




       num

        n

       name

      midterm
1.6                   action)
             1                          (num)
             2)                           for (n =1; n<=num ;
n++)
                                               2.1-2.6
                      3
                   2.1)                  (n)
                   2.2)                            (name)
                  (midterm)
                        (final)
                   2.3)                        (score) =
midterm + final
                   2.4)         score
                   2.5)                         (sum) = sum +
score
                   2.6)                  2
             3)                   (average) = sum / num
start

2.
                 num



     For (n = 1 ; n <= num ; n++)   n > num


                       n <= num

                       n                      Averge = sum / num




           name,midterm,final                      average




      Score = midterm + final                     end




                   score



         sum = sum + score
3.
     #include <stdio.h>
     /* file name ex_for3.cpp*/
     main ()
     {
     char name [30] ;
     int midterm = 0 , final = 0 , score = 0 ,n , num ;
     float sum = 0 , average = 0 ;
     printf (“ key loop => “) ; scanf (“%d “,&num) ;
     Printf (“n Report Score n”) ;
     printf(“*************************n n”) ;

     for(n = 1;n <= num ; n++)
          {
          printf ({“No. => %d n” , n) ;
          printf (“Name is => “) ;       scanf (“%s”,name) ;
          printf (“midterm is => “) ;       scanf (“%d”&midterm) ;
          printf (“final is => “) ;  scanf (“%d”&final) ;
          score = midterm =+ final;
          printf ( “* score = %dn”,score) ;
          sum = sum + score ;
          printf (“*****************n”) ;
           }

     average = sum / num ;
     printf (“* Averge score is = %.2f n” , averge) ;
     printf (“***********************n) ;

     }
while
                for



                      while



endless loop)
while
while
     while       statement ;
    while
{
         ;
         ;

             ;
}
         while
#include <stdio.h>
int counter , num;
char word[20] = "Bodindecha";
main()
{
    num = 0;
    counter = 3;
    while ( counter <= 11)
{
     printf("ntcounter = %2d my school is %s print
round %d. ",counter,word,++num);
    counter = counter + 2 ;
       }
getch();

}
num
counter                                          while
                            counter <= 11


 printf("ntcounter = %2d my school is %s print round %d.
                   ",counter,word,++num);

          counter = counter + 2
counter

counter                            counter <= 11
do-while
     do while
 loop)
while


                do       while


                     endless loop)
do while
do while


Do {
          ;
          ;

              ;
} while           ;
#include <stdio.h>
int counter ,num ;
char word[20] = "Bodindecha";
main()
{
 Num = 0;
counter = 3;
do                                                  /*
start do while */
{
    printf("ntcounter = %2d my school is %s print
round %d. ",counter,word,++num);
    counter = counter + 2 ;
     } while (counter < 11 );                        /*
end do while */
getch();
}
/* end main() */
counter
                                        do while

printf("ntcounter = %2d my school is %s print round %d.
   ",counter,word,++num);      counter = counter + 2;


counter < 11

                                       counter
for
while



{}
             {}
do -while

        {}1



while
10
      28
       29
       32
      33
      34
      35
6/2

More Related Content

Viewers also liked

Matematika itu mudah dan menyenangkan
Matematika itu mudah dan menyenangkanMatematika itu mudah dan menyenangkan
Matematika itu mudah dan menyenangkanPuput Putri
 
Andriod tp1 LRR
Andriod tp1 LRRAndriod tp1 LRR
Andriod tp1 LRR
Elpaputorres
 
Adding slide share instructions
Adding slide share instructionsAdding slide share instructions
Adding slide share instructionsChloestryvegroup
 
Diego ricol freyre
Diego ricol freyreDiego ricol freyre
Diego ricol freyre
Diego Ricol Freyre
 
The sea gull and the tortoise
The sea gull and the tortoiseThe sea gull and the tortoise
The sea gull and the tortoise
Maya Mladenova
 
diego ricol
diego ricol diego ricol
diego ricol
Diego Ricol Freyre
 
Diego ricol freyre
Diego ricol freyreDiego ricol freyre
Diego ricol freyre
Diego Ricol Freyre
 
Fotografía surrealista
Fotografía surrealistaFotografía surrealista
Fotografía surrealista
Diego Ricol Freyre
 

Viewers also liked (8)

Matematika itu mudah dan menyenangkan
Matematika itu mudah dan menyenangkanMatematika itu mudah dan menyenangkan
Matematika itu mudah dan menyenangkan
 
Andriod tp1 LRR
Andriod tp1 LRRAndriod tp1 LRR
Andriod tp1 LRR
 
Adding slide share instructions
Adding slide share instructionsAdding slide share instructions
Adding slide share instructions
 
Diego ricol freyre
Diego ricol freyreDiego ricol freyre
Diego ricol freyre
 
The sea gull and the tortoise
The sea gull and the tortoiseThe sea gull and the tortoise
The sea gull and the tortoise
 
diego ricol
diego ricol diego ricol
diego ricol
 
Diego ricol freyre
Diego ricol freyreDiego ricol freyre
Diego ricol freyre
 
Fotografía surrealista
Fotografía surrealistaFotografía surrealista
Fotografía surrealista
 

Similar to การเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม.6 ห้อง2

รายงานการเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม. 6 ห้อง2
รายงานการเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม. 6 ห้อง2รายงานการเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม. 6 ห้อง2
รายงานการเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม. 6 ห้อง2Pookie Pook
 
8 arrays and pointers
8  arrays and pointers8  arrays and pointers
8 arrays and pointers
MomenMostafa
 
C++ Programm.pptx
C++ Programm.pptxC++ Programm.pptx
C++ Programm.pptx
Åįjâž Ali
 
Cpl
CplCpl
halstead software science measures
halstead software science measureshalstead software science measures
halstead software science measuresDeepti Pillai
 
verilog code
verilog codeverilog code
verilog code
Mantra VLSI
 
C-LOOP-Session-2.pptx
C-LOOP-Session-2.pptxC-LOOP-Session-2.pptx
C-LOOP-Session-2.pptx
Sarkunavathi Aribal
 
21221
2122121221
21221
inKFUPM
 
Solucionario_de_Chapra_y_Canale_Quinta_E.pdf
Solucionario_de_Chapra_y_Canale_Quinta_E.pdfSolucionario_de_Chapra_y_Canale_Quinta_E.pdf
Solucionario_de_Chapra_y_Canale_Quinta_E.pdf
JeancarlosPatalasanc
 
Looping
LoopingLooping
Infix prefix postfix
Infix prefix postfixInfix prefix postfix
Infix prefix postfix
Self-Employed
 
PROGRAMMING IN C EXAMPLE PROGRAMS FOR NEW LEARNERS - SARASWATHI RAMALINGAM
PROGRAMMING IN C EXAMPLE PROGRAMS FOR NEW LEARNERS  - SARASWATHI RAMALINGAMPROGRAMMING IN C EXAMPLE PROGRAMS FOR NEW LEARNERS  - SARASWATHI RAMALINGAM
PROGRAMMING IN C EXAMPLE PROGRAMS FOR NEW LEARNERS - SARASWATHI RAMALINGAM
SaraswathiRamalingam
 
Introducing to Asynchronous Programming
Introducing to Asynchronous  ProgrammingIntroducing to Asynchronous  Programming
Introducing to Asynchronous Programming
Александр Федоров
 
Recursion in C
Recursion in CRecursion in C
Recursion in C
Lakshmi Sarvani Videla
 
12 lec 12 loop
12 lec 12 loop 12 lec 12 loop
12 lec 12 loop
kapil078
 
Simple C programs
Simple C programsSimple C programs
Simple C programs
ab11cs001
 
An efficient algorithm for the computation of Bernoulli numbers
 An efficient algorithm for the computation of Bernoulli numbers An efficient algorithm for the computation of Bernoulli numbers
An efficient algorithm for the computation of Bernoulli numbers
XequeMateShannon
 
All I Needed for Functional Programming I Learned in High School Algebra
All I Needed for Functional Programming I Learned in High School AlgebraAll I Needed for Functional Programming I Learned in High School Algebra
All I Needed for Functional Programming I Learned in High School Algebra
Eric Normand
 

Similar to การเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม.6 ห้อง2 (20)

รายงานการเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม. 6 ห้อง2
รายงานการเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม. 6 ห้อง2รายงานการเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม. 6 ห้อง2
รายงานการเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม. 6 ห้อง2
 
8 arrays and pointers
8  arrays and pointers8  arrays and pointers
8 arrays and pointers
 
C++ Programm.pptx
C++ Programm.pptxC++ Programm.pptx
C++ Programm.pptx
 
Cpl
CplCpl
Cpl
 
halstead software science measures
halstead software science measureshalstead software science measures
halstead software science measures
 
901131 examples
901131 examples901131 examples
901131 examples
 
verilog code
verilog codeverilog code
verilog code
 
C-LOOP-Session-2.pptx
C-LOOP-Session-2.pptxC-LOOP-Session-2.pptx
C-LOOP-Session-2.pptx
 
21221
2122121221
21221
 
Solucionario_de_Chapra_y_Canale_Quinta_E.pdf
Solucionario_de_Chapra_y_Canale_Quinta_E.pdfSolucionario_de_Chapra_y_Canale_Quinta_E.pdf
Solucionario_de_Chapra_y_Canale_Quinta_E.pdf
 
Looping
LoopingLooping
Looping
 
Infix prefix postfix
Infix prefix postfixInfix prefix postfix
Infix prefix postfix
 
Assignment 3
Assignment 3Assignment 3
Assignment 3
 
PROGRAMMING IN C EXAMPLE PROGRAMS FOR NEW LEARNERS - SARASWATHI RAMALINGAM
PROGRAMMING IN C EXAMPLE PROGRAMS FOR NEW LEARNERS  - SARASWATHI RAMALINGAMPROGRAMMING IN C EXAMPLE PROGRAMS FOR NEW LEARNERS  - SARASWATHI RAMALINGAM
PROGRAMMING IN C EXAMPLE PROGRAMS FOR NEW LEARNERS - SARASWATHI RAMALINGAM
 
Introducing to Asynchronous Programming
Introducing to Asynchronous  ProgrammingIntroducing to Asynchronous  Programming
Introducing to Asynchronous Programming
 
Recursion in C
Recursion in CRecursion in C
Recursion in C
 
12 lec 12 loop
12 lec 12 loop 12 lec 12 loop
12 lec 12 loop
 
Simple C programs
Simple C programsSimple C programs
Simple C programs
 
An efficient algorithm for the computation of Bernoulli numbers
 An efficient algorithm for the computation of Bernoulli numbers An efficient algorithm for the computation of Bernoulli numbers
An efficient algorithm for the computation of Bernoulli numbers
 
All I Needed for Functional Programming I Learned in High School Algebra
All I Needed for Functional Programming I Learned in High School AlgebraAll I Needed for Functional Programming I Learned in High School Algebra
All I Needed for Functional Programming I Learned in High School Algebra
 

Recently uploaded

The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
UiPathCommunity
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 

Recently uploaded (20)

The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 

การเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม.6 ห้อง2

  • 1. 1. 1.1 Increment Operator 4.1 ++ increment 1 b=3 ; a=b ++ 1 2 a=b; a=3 b=b+1; b=3+1
  • 2. b=3 ; a=++b 1. 2 b=b +1; b=3+1 a=b; a=4 2. a 4 b 4 -- decrement 1 1.2 decrement operator 4.2
  • 3. b=3 a=b - - 1. 2 a=b; a=3 b=b-1; b=3-1 2. a 3 b 2 a= - -b 1. 2
  • 4. 1.3 (compound assignment operators) 4.3
  • 5. 1.4
  • 6. a = b ++ ; 2 a=b; b a a=4 a=b+1 ; 4+1 5 b b=5 b = ++ a ; a=a+1; a 4 4+1
  • 7. 1.5 implicit type conversion explicit type conversion
  • 8. 4.3
  • 9. 4.3 4.3 1. result 1 = value1 + value 2 ; 10 + 3.17 13.17 result 1 2. result 1 = value / 3 ; / % .2f
  • 10. 2 for : 3 : for For ( = ; ; 2.1 ) { for statemmnt (s) ; } for : 1
  • 11. 4.1 for 2.2 for 5
  • 12. 4.4 for
  • 13. 1. 5 2. n 1 3. n 6 4.
  • 14. 2.3 for 4.5 for
  • 15. 4.5 4.5 1 2. 3 3 3.
  • 16. 3. while : while {} while {} while
  • 17. while while > {}
  • 18. 3.2 while while
  • 19. Ctrl- Break n <= 5 n n
  • 20. while while while n <= 5 n = n+1 ;
  • 21.
  • 22. while n while n
  • 23. n num
  • 25. do – while do – while do – whil
  • 26. do – while do – while
  • 27. { } while n <= 5 n>5 n++ : n=n +1: n n>5
  • 28. { } do – while
  • 30. for • while • do- while
  • 31. For for 2 3 for
  • 32. n key loop =>…………… Report Score **************************** No. => …………… name is => ………….. midterm is => ………….. Final is => …………… * Score = …………… ***************************** *Average Score is = …………. *****************************
  • 33. 1. 1.1 1.2 = 1 = = = 1.3
  • 34. 1.5 num n name midterm
  • 35. 1.6 action) 1 (num) 2) for (n =1; n<=num ; n++) 2.1-2.6 3 2.1) (n) 2.2) (name) (midterm) (final) 2.3) (score) = midterm + final 2.4) score 2.5) (sum) = sum + score 2.6) 2 3) (average) = sum / num
  • 36. start 2. num For (n = 1 ; n <= num ; n++) n > num n <= num n Averge = sum / num name,midterm,final average Score = midterm + final end score sum = sum + score
  • 37. 3. #include <stdio.h> /* file name ex_for3.cpp*/ main () { char name [30] ; int midterm = 0 , final = 0 , score = 0 ,n , num ; float sum = 0 , average = 0 ; printf (“ key loop => “) ; scanf (“%d “,&num) ; Printf (“n Report Score n”) ; printf(“*************************n n”) ; for(n = 1;n <= num ; n++) { printf ({“No. => %d n” , n) ; printf (“Name is => “) ; scanf (“%s”,name) ; printf (“midterm is => “) ; scanf (“%d”&midterm) ; printf (“final is => “) ; scanf (“%d”&final) ; score = midterm =+ final; printf ( “* score = %dn”,score) ; sum = sum + score ; printf (“*****************n”) ; } average = sum / num ; printf (“* Averge score is = %.2f n” , averge) ; printf (“***********************n) ; }
  • 38.
  • 39. while for while endless loop)
  • 40. while
  • 41. while while statement ; while { ; ; ; } while
  • 42. #include <stdio.h> int counter , num; char word[20] = "Bodindecha"; main() { num = 0; counter = 3; while ( counter <= 11) { printf("ntcounter = %2d my school is %s print round %d. ",counter,word,++num); counter = counter + 2 ; } getch(); }
  • 43. num counter while counter <= 11 printf("ntcounter = %2d my school is %s print round %d. ",counter,word,++num); counter = counter + 2 counter counter counter <= 11
  • 44.
  • 45. do-while do while loop) while do while endless loop)
  • 47. do while Do { ; ; ; } while ;
  • 48. #include <stdio.h> int counter ,num ; char word[20] = "Bodindecha"; main() { Num = 0; counter = 3; do /* start do while */ { printf("ntcounter = %2d my school is %s print round %d. ",counter,word,++num); counter = counter + 2 ; } while (counter < 11 ); /* end do while */ getch(); } /* end main() */
  • 49. counter do while printf("ntcounter = %2d my school is %s print round %d. ",counter,word,++num); counter = counter + 2; counter < 11 counter
  • 50.
  • 51.
  • 52. for
  • 53. while {} {}
  • 54. do -while {}1 while
  • 55. 10 28 29 32 33 34 35 6/2