ConceptStep · learning platform for computer science

Comparisons: true or false

C programming · Lesson

C · lesson 5 / 27

Comparisons: true or false

Connect relational operators to the flowchart decision diamond.

1 · Observe and predict

The concept

<, <=, >, >=, == and != produce a logical result; in C true is 1 and false is 0.

Mental model:

read a,b → evaluate a > b → TRUE: 1 · FALSE: 0

2 · Flowchart First

Follow the same algorithm as a flowchart

Use Start and Step: when the active block changes, ConceptStep also highlights the C lines representing that same step.

Loading flowchart…
3 · Flowchart ↔ C · Run in Page

Lab 1 — Run the example program

Run C executes only the example shown on the left, using stdin on the right. The coding challenge below has a separate editor and test button.

Comparisons: true or false Start the flowchart to synchronize the code
                        1#include <stdio.h>
                        2 
                        3int main(void)
                        4{
                        5    int a;
                        6    int b;
                        7    int risultato;
                        8 
                        9    scanf("%d", &a);
                        10    scanf("%d", &b);
                        11    risultato = a > b;
                        12    printf("%d\n", risultato);
                        13    return 0;
                        14}
Ready. Make a prediction before running.

                    
                

Lab 2 — Coding challenge: write your code — Comparing numbers

Read two integers and print 1 if the first is greater, otherwise 0.

This is a different program from lab 1. Complete the starter code: Check all test cases compiles this editor and tests every input, including boundary cases.

4 · Guided practice

Check your prediction

If a = 2 and b = 5, what is a > b?

Challenge 1 / 5 · Understanding

Progress: 0 / 5 · correct: 0

Your competency map

What you need to know for Comparisons: true or false

ConceptStep separates what is required from what is recommended or useful as reinforcement. Only required prerequisites block your progress.

Current topic Strong skill Review due Needs reinforcement To be mastered Optional support

Relationships: solid line = required · dashed line = recommended · dotted line = reinforcement.

GUIDED LEARNING PATHS

Want to choose the next skill to develop?