Turn Desktop View Off
You are here:   HomeC Programming (Theory)Control Structures in CWrite a C program to print the reverse of digit.
by Dinesh Thakur Category: Control Structures

In some situations we may have to change the order of execution of statements based on certain conditions , or repeat a group of statements until certain specified conditions are met. For these situation C provides decision making statements also know as control statements. C has following control statements:

by Dinesh Thakur Category: Control Structures

For loop: When it is desired to do initialization, condition check and increment/decrement in a single statement of an iterative loop, it is recommended to use 'for' loop.

by Dinesh Thakur Category: Control Structures

1. Factorial of a number.
2. Prime or not
3. Odd or even
4. Exit
Once a menu item is selected the appropriate action should be taken and once this action is finished, the menu should reappear. Unless the user selects the 'Exit' option the program should continue to work. 

by Dinesh Thakur Category: Control Structures

In this example, the initial and final values of loop variable i (of type int) are 1 and 10, respectively. The increment expression, i += 1, increases the value of i by 1. Thus, i assume values 1, 2, 3, 4 and 5.

by Dinesh Thakur Category: Control Structures

The program segment given below converts an uppercase letter to lowercase. As the C language allows arithmetic operations on characters, we can use expression such as ‘a’ – ‘A’, ‘g’ – ‘G’, etc. instead of literal 32.


Page 1 of 28

Subscribe To Free Daily Newsletter!

Get Free News Updates Delivered Directly To Your Inbox
About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular Computer Notes blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to contact us.

What's New and Popular

Popular Article