Course Hive
Search

Welcome

Sign in or create your account

Continue with Google
or
Nested if statements are easy! ๐ŸŽŸ๏ธ
Play lesson

C tutorial for beginners โš™๏ธ - Nested if statements are easy! ๐ŸŽŸ๏ธ

4.0 (0)
13 learners

What you'll learn

This course includes

  • 6.5 hours of video
  • Certificate of completion
  • Access on mobile and TV

Summary

Keywords

Full Transcript

#coding #programming #cprogramming float price = 10.00; bool isStudent = true; // 10% discount bool isSenior = true; // 20% discount // student = $9 // senior = $8 // student + senior = $7 if(isStudent){ if(isSenior){ printf("You get a student discount of 10%\n"); printf("You get a senior discount of 20%\n"); price *= 0.7; } else{ printf("You get a student discount of 10%\n"); price *= 0.9; } } else{ if(isSenior){ printf("You get a senior discount of 20%\n"); price *= 0.8; } } printf("The price of a ticket is: $%.2f\n", price); return 0;

Course Hive

Continue this lesson in the app

Install CourseHive on Android or iOS to keep learning while you move.

Related Courses

FAQs

Course Hive
Download CourseHive
Keep learning anywhere