C Programming Looping (while, do while, for Loops) Exercises / Examples

Looping is the process by which you can give instruction to the compiler to execute a code segment repeatedly, here you will find programs related to c looping – programs using for, while and do while. Here you will get nested looping (loop within loop) programs.

List of C Looping programs using while, do while, for

  1. C program to print ODD numbers from 1 to N using while loop.
    This is an example of while loop - In this C program, we are going to learn how can we print all ODD numbers from given range (1 to N) using while loop?
  2. C program to print EVEN numbers from 1 to N using while loop.
    This is an example of while loop - In this C program, we are going to learn how can we print all EVEN numbers from given range (1 to N) using while loop?
  3. C program to print all uppercase alphabets using while loop.
    This is an example of while loop in C programming language - In this C program, we are going to print all uppercase alphabets from ‘A’ to ‘Z’ using while loop.
  4. C program to print all lowercase alphabets using while loop.
    This is an example of while loop in C programming language - In this C program, we are going to print all lowercase alphabets from ‘a’ to ‘z’ using while loop.
  5. C program to print numbers from 1 to N using while loop.
    This is an example of while loop in C programming language - In this C program, we are going to print numbers from 1 to N using while loop.
  6. C program to print numbers from 1 to 10 using while loop.
    This is an example of while loop in C programming language - In this C program, we are going to print numbers from 1 to 10 using while loop.
  7. C program to read an integer and print its multiplication table.
    In this program, we are reading an integer number and printing its multiplication table, we are implementing the program using for, while and do while (through all loops).
  8. C Program to print tables from numbers 1 to 20.
    This program will print table of numbers from 1 to 20 using nested looping. There are two loops using parent loop to run from 1 to 20 and child loop to run from 1 to 10 to print table of corresponding number which is coming from parent loop.
  9. C Program to check entered number is ZERO, POSITIVE or NEGATIVE until user does not want to quit.
    This program will read an integer number and check whether entered number is Positive, Negative or Zero until user does not want to exit.
  10. C Program to find factorial of a number.
    In this program, we will read and integer number and find the factorial using different methods - using simple method (without using user define function), using User Define Function and using Recursion.
  11. C Program to find sum of first N natural number, N must be taken by the user.
    This program will read the value of N and calculate sum from 1 to N, first N natural numbers means numbers from 1 to N and N will be read through user.
  12. C program to print all prime numbers from 1 to N.
    This program will read the value of N and print all prime numbers from 1 to N. The logic behind implement this program - Run loop from 1 to N and check each value in another loop, if the value is divisible by any number between 2 to num-1 (or less than equal to num/2) - Here num is the value to check it is prime of not.
  13. C program to print all even and odd numbers from 1 to N.
    This program will read value of N and print all numbers from 1 to N with EVEN and ODD after checking the numbers whether they are EVEN or ODD.
  14. C program to print all Armstrong numbers from 1 to N.
    This program will read value of N and print all Armstrong Numbers from 1 to N.
  15. C program to print square, cube and square root of all numbers from 1 to N.
    This program will print Square, Cube and Square Root of all Numbers from 1 to N using loop.
  16. C program to print all leap years from 1 to N.
    This program will read value of N and print all Leap Years from 1 to N years. There are two conditions for leap year: 1- If year is divisible by 400 ( for Century years), 2- If year is divisible by 4 and must not be divisible by 100 (for Non Century years).
  17. C program to print all upper case and lower case alphabets.
    In this C program, we are going to print all uppercase alphabets (from 'A' to 'Z') and lowercase alphabets (from 'a' to 'z').
  18. C program to read age of 15 person and count total Baby age, School age and Adult age.
    This program will read age of 15 person one by one (using while loop) and count total number of Baby Age, School attending person age and Adult age person.

List of other C programs

  1. C program to declare memory for an integer variable dynamically.
  2. C program to read and print name, where memory for variable should be declared at run time.
  3. C program to find sum of array elements using Dynamic Memory Allocation.
  4. C Program to find the sum of digits of a number until a single digit is occurred.
  5. C program to find class of an IP Address.
  6. Stringizing Operator in C - Program to print variable name in C.
  7. Function Pointer example program in C programming.
  8. C program to get current System Date and Time in Linux.
  9. C program to implement gotoxy(),clrscr(),getch(),getche() for GCC, Linux.
  10. C program to find the size of a file in Linux.
  11. C program to get Process Id and Parent Process Id in Linux.
  12. fork() function explanation and examples in Linux C.
  13. C program to Get Computer System IP Address in Linux.
  14. C program to Set Computer System IP Address in Linux.
  15. C program to design flying characters Screen Saver.
  16. C program to design a TIC TAC TOE game.
  17. Age Calculator (C program to calculate age).
  18. C program to design love calculator.
  19. C program to guess a random number.
  20. C program to check given string is a valid IPv4 address or not.
  21. C program to convert String into Hexadecimal.
  22. C program to demonstrate example of Variable Arguments.
  23. C program to store time in an integer variable.
  24. C program to store date in an integer variable.
  25. C program to remove consecutive repeated characters from string.
  26. C program to create your own header file.
  27. EMI Calculator (C program to calculate EMI).
  28. C program to validate date (Check date is valid or not).
  29. C program to format/extract ip address octets.
  30. C program to implement substring function.
  31. C program to design a digital clock.
  32. C program to convert hexadecimal Byte to integer.
  33. C program to extract bytes from an integer (Hexadecimal) value.
  34. C program to print character without using format specifiers.
  35. C program to find Binary Addition and Binary Subtraction.
  36. C program to print weekday of given date.
  37. C program to calculate compound interest.



Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.