Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
if-else Operator Practice | Control Statements
C Basics
course content

Course Content

C Basics

C Basics

1. Introduction
2. Data
3. Operators
4. Control Statements
5. Functions
6. Pointers

if-else Operator Practice

A Program Alerting High Temperature

c

main

copy
123456789101112131415161718
#include <stdio.h> int main() { int temperature = 200; // in celsius if (temperature > 80) { printf("Temperature is so high: %d degrees Celsius\n", temperature); } else { printf("Temperature is normal: %d degrees Celsius\n", temperature); } return 0; }

Task

Construct a calculator that divides numbers, but only if neither of the numbers is zero.

Task

Construct a calculator that divides numbers, but only if neither of the numbers is zero.

Switch to desktop for real-world practiceContinue from where you are using one of the options below

Everything was clear?

Section 4. Chapter 2
toggle bottom row

if-else Operator Practice

A Program Alerting High Temperature

c

main

copy
123456789101112131415161718
#include <stdio.h> int main() { int temperature = 200; // in celsius if (temperature > 80) { printf("Temperature is so high: %d degrees Celsius\n", temperature); } else { printf("Temperature is normal: %d degrees Celsius\n", temperature); } return 0; }

Task

Construct a calculator that divides numbers, but only if neither of the numbers is zero.

Task

Construct a calculator that divides numbers, but only if neither of the numbers is zero.

Switch to desktop for real-world practiceContinue from where you are using one of the options below

Everything was clear?

Section 4. Chapter 2
toggle bottom row

if-else Operator Practice

A Program Alerting High Temperature

c

main

copy
123456789101112131415161718
#include <stdio.h> int main() { int temperature = 200; // in celsius if (temperature > 80) { printf("Temperature is so high: %d degrees Celsius\n", temperature); } else { printf("Temperature is normal: %d degrees Celsius\n", temperature); } return 0; }

Task

Construct a calculator that divides numbers, but only if neither of the numbers is zero.

Task

Construct a calculator that divides numbers, but only if neither of the numbers is zero.

Switch to desktop for real-world practiceContinue from where you are using one of the options below

Everything was clear?

A Program Alerting High Temperature

c

main

copy
123456789101112131415161718
#include <stdio.h> int main() { int temperature = 200; // in celsius if (temperature > 80) { printf("Temperature is so high: %d degrees Celsius\n", temperature); } else { printf("Temperature is normal: %d degrees Celsius\n", temperature); } return 0; }

Task

Construct a calculator that divides numbers, but only if neither of the numbers is zero.

Switch to desktop for real-world practiceContinue from where you are using one of the options below
Section 4. Chapter 2
Switch to desktop for real-world practiceContinue from where you are using one of the options below
We're sorry to hear that something went wrong. What happened?
some-alt