Looking for a Tutor Near You?

Post Learning Requirement »
x

Choose Country Code

x

Direction

x

Ask a Question

x

x
x
x
Hire a Tutor

The C Programming -Chapter 4 (part 3)

Loading...

Published in: C / C++
240 Views

Here I explained the Decision making method of C programming. It is called If . statement . Its are 4 types . So, I uploaded 4 PPT. Thanking you

Uma / Madurai

3 years of teaching experience

Qualification: M.Sc (Rena Infotech, Cheranmahadevi - 2013)

Teaches: Advanced Excel, Basic Computer, Computer for official job, MS Office, School Level Computer, All Subjects, Biology, Computer Science, History, Social Studies, Geography, B.Sc Tuition, B.Tech Tuition, IT, M.Sc Tuition, C / C++, Java And J2EE, Visual Basic

Contact this Tutor
  1. C — Statements (3. If else ladder statement)
  2. Structure of if else ladder statement • if else if ladder in C programming is used to test a series of conditions sequentially. Furthermore, if a condition is tested only when all previous if conditions in the if-else ladder are false. If any of the conditional expressrons evaluatefto the appropriate code block will be executed, and the entire if-else ladder will be terminated.
  3. Syntax: // any if-else ladder starts with an if statement only if(condition) else if(condition) { // this else if will be executed When condition in if is false and // the condition of this else if is true // once if-else ladder can have multiple else if else l/ at the end we put else
  4. Structure Statement 1 Condition Else Condition Stateme nt
  5. Example // C Program to Calculate Grade According to marks // using the if else if ladder #include <stdio.h> int main() int marks = 91 ; if (marks <= 100 && marks >= 90) printf("A+ Grade"); else if (marks < 90 && marks >= 80) printf(" A Grade"); else if (marks < 80 && marks 70) elseif (marks < 70 && marks 60) Grade"); else if (marks < 60 && marks 50) printf("D Grade"); else printf("F Failed"); return O;
  6. Output A+ Grade