SlideShare a Scribd company logo
1 of 55
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

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 pointersMomenMostafa
 
halstead software science measures
halstead software science measureshalstead software science measures
halstead software science measuresDeepti Pillai
 
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.pdfJeancarlosPatalasanc
 
Infix prefix postfix
Infix prefix postfixInfix prefix postfix
Infix prefix postfixSelf-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 RAMALINGAMSaraswathiRamalingam
 
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 programsab11cs001
 
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 numbersXequeMateShannon
 
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 AlgebraEric 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

Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 

Recently uploaded (20)

Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 

การเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 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