Flow Control - C# Programming Exercises

Explore our curated collection of Flow Control C# Programming Exercises! Designed to strengthen your understanding and mastery of flow control structures in C#, these exercises offer a hands-on approach to learning. From conditional statements to loops and switch cases, each exercise is crafted to help you navigate the complexities of program flow with confidence. Whether you're a beginner or looking to refine your skills, dive in and elevate your C# programming proficiency today!

  •  Positive and negative

    In this C# exercise, you will learn how to create a program that determines whether a number entered by the user is positive or negative. The program will prom...

  •  Multiply if not zero

    In this C# exercise, you will learn how to create a program that asks the user for a number. If the entered number is not zero, the program will ask for a second number and ...

  •  Divide if not zero

    In this C# exercise, you will learn how to create a program that asks the user for two numbers. If the second number is not zero, the program will perform the division...

  •  Divide if not zero (Using else)

    In this C# exercise, you will learn how to modify the previous program using the else control structure. The program will ask the user for two numbers, and if the sec...

  •  Greatest of three numbers

    In this C# exercise, you will learn how to write a program that prompts the user to enter three numbers and displays the greatest one. The program will use conditional struc...

  •  Repeat until 0

    In this C# exercise, you will learn how to write a program that asks the user to enter a number "x" and displays the result of multiplying it by 10. The program will keep as...

  •  Repeat until 0 (Use Do While)

    In this C# exercise, you will learn how to write a program that asks the user to enter a number "x" and displays the result of multiplying it by 10. The program will keep re...

  •  While + Counter

    In this C# exercise, you will learn how to write a program that displays the numbers from 1 to 10 on the screen using a while loop. The while loop is a control...

  •  Multiplication table (use while)

    In this C# exercise, you will learn how to write a program that asks the user to enter a number and then displays its multiplication table using a while loop. The ...

  •  Odd numbers descending

    In this C# exercise, you will learn how to write a program that displays the odd numbers from 15 down to 7 using a while loop. The while loop is a control stru...

  •  Sum numbers

    In this C# exercise, you will learn how to write a program that asks the user to enter an undetermined amount of numbers (until 0 is entered) and displays the total sum of t...

  •  Two negative numbers

    In this C# exercise, you will learn how to write a program that prompts the user to enter two numbers and determines whether both numbers are negative or not. This type of p...

  •  One or two negative numbers

    In this C# exercise, you will learn how to write a program that prompts the user to enter two numbers and then determines whether both numbers are negative, only one is nega...

  •  Multiples

    In this exercise, you will learn how to use the modulo operator % to find numbers between 1 and 500 that are divisible by both 3 and 5. The program will...

  •  Number repeated

    This exercise teaches you how to display a number repeated a number of times specified by the user. Three loop structures will be used to perform the repetition: while, d...

  •  Password

    In this C# programming exercise, the user is asked to enter their login and password, both as integer numbers. The goal is to create a program that repeatedly ...

  •  Password V2

    This C# exercise aims to create a program that asks the user for their login and password (both must be integer numbers) and repeats the request until the ente...

  •  Many divisions

    This C# exercise aims to develop a program that asks the user for two numbers and displays the result of the division of these numbers along with the remainder of the divisi...

  •  Several multiplication tables, (use do while)

    This C# exercise aims to create a program that displays multiplication tables from 2 to 6 using nested do...while loops. A do...while loop executes a block of ...

  •  Square

    This C# exercise aims to create a program that prompts the user to enter a number and a width, then displays a square with the given width, using...

  •  Break & continue

    This C# exercise aims to develop a program that displays the even numbers from 10 to 20, both inclusive, except for 16, using three different approaches...

  •  Rectangle V2

    This C# exercise aims to develop a program that asks the user for a number, a width, and a height, and then displays a rectangle with the provide...

  •  Repetitive structures

    This C# exercise aims to develop a program that prompts the user for two numbers and displays all the numbers between them (inclusive) three times using for, while...

  •  Digits in a number

    This C# exercise aims to teach how to develop a program that calculates the number of digits in a positive integer. The program uses an efficient technique by perform...

  •  Hollow square

    This C# exercise aims to develop a program that asks the user for a symbol and a width, and then displays a hollow square of that width using the provid...

  •  Product

    This C# exercise aims to develop a program that asks the user for two integer numbers and shows their multiplication, but without using the "*" operator. Inste...

  •  Absolute value

    This C# exercise aims to develop a program that calculates (and displays) the absolute value of a number x. The absolute value of a number is its distan...

  •  Hollow rectangle

    This C# exercise aims to develop a program that prompts the user for a symbol, a width, and a height, then displays a hollow rectangle of the spe...

  •  Statistics

    This C# exercise aims to develop a program that allows the user to input several numbers and calculate basic statistical operations such as sum, average, mi...

  •  Switch

    This C# exercise aims to develop a program that, given a numerical grade, displays the corresponding text grade according to the following equivalence: 9 and ...

  •  Conditional operator, positive & smaller

    This C# exercise aims to develop a program that asks the user for two numbers and uses the conditional operator (?) to answer the following questions: ...

  •  Prime number

    This C# exercise aims to develop a program that asks the user for an integer and determines if it is a prime number or not. A prime number is one...

  •  Give change

    This exercise in C# aims to develop a program that calculates the change for a purchase, using the largest possible coins or bills. The program s...

  •  Exceptions

    This exercise in C# aims to develop a program that asks the user for two numbers and displays their division. The program should handle potential errors...

 More C# Programming Exercises Grouped

  •  First contact with C# Sharp

    Explore our set of C# programming exercises! Specifically designed for beginners, these exercises will help you develop a solid understanding of the basics of C#. From variables and data types to control structures and s...

  •  Basic Data Types

    Explore our comprehensive collection of Basic Data Types C# Programming Exercises! Designed to provide hands-on practice with fundamental data types in C#, these exercises are perfect for beginners looking to solidify th...

  •  Arrays, Structures and Strings

    Explore our curated selection of Arrays, Structures, and Strings C# Programming Exercises! Tailored to provide practical experience with essential data structures and string manipulation in C#, these exercises offer a dy...

  •  Functions

    Embark on a journey of learning with our Functions C# Programming Exercises! Tailored for beginners, these exercises offer a hands-on approach to mastering the art of functions in C#. From understanding the basics of fun...

  •  OOP Object Oriented Programming

    Unlock the power of Object-Oriented Programming (OOP) with our C# exercises! These lessons cover classes, objects, and core principles like inheritance and polymorphism. Perfect for beginners, each exercise offers a hand...

  •  OOP More On Classes

    Dive deeper into Object-Oriented Programming with our advanced C# exercises! This section explores advanced class features, interfaces, and more. Whether you're reinforcing your OOP skills or preparing for complex projec...

  •  File Management

    Explore File Management in C# with our hands-on exercises! Learn to create, read, write, and manage files in your applications. These lessons are perfect for gaining practical experience with file handling in C#. Enhance...

  •  Object Persistence

    Master the art of Object Persistence in C#! These exercises focus on saving and retrieving objects, helping you build applications that store data effectively. Perfect for learners ready to explore advanced storage techn...

  •  Access To Relational Databases

    Delve into Access to Relational Databases in C#! These exercises provide practical experience connecting to and working with databases like SQL Server. Learn to execute queries, manage data, and integrate database functi...

  •  Dynamic Memory Management

    Learn Dynamic Memory Management in C#! These exercises guide you through concepts like pointers and memory allocation, crucial for building efficient applications. Develop a deeper understanding of how C# manages memory ...

  •  Additional Libraries

    Discover Additional Libraries in C#! These exercises introduce libraries that expand the capabilities of your C# applications. From working with collections to threading and beyond, these lessons will elevate your progra...

 Maybe you will be interested in these C# Programming Exercises

  •  Char

    This exercise in C# aims to develop a program that asks the user for three letters and displays them in reverse order. The user will input one letter at...

  •  Triangle

    This exercise in C# aims to develop a program that prompts the user for a symbol and a width, and then displays a decreasing triangle of the spec...

  •  Password as string

    This exercise in C# aims to develop a program that asks the user for their username and password (both as strings) and repeats the prompt as many...

  •  Password 5 attempts

    This C# exercise involves creating a program that prompts the user for their username and password, both as strings. If the entered credentials do not m...

  •  Calculator - if

    This C# programming exercise requires creating a program that asks the user for two numbers and an operation to perform on them. The supported operations are ...

  •  Calculator - switch

    In this C# programming exercise, you need to create a program that asks the user for two numbers and a mathematical operation to perform between them. Supporte...