We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7
Programming in C
Control Flow Statement - Loop
Instructor: Md. Biplob Hosen
Lecturer, IIT-JU Email: [email protected] Contents • Control Flow Statement • Loop • Practice Tasks Loop • Loops can execute a block of code as long as a specified condition is reached. • In programming, a loop is used to repeat a block of code until the specified condition is met. • C programming has three types of loops: • for loop • while loop • do...while loop For Loop • While loop For loop do-while loop Practice Tasks Write C Program: 1. Write a program to print your name N times. 2. Write a program to display the first N natural numbers. 3. Write a program to find all even numbers & odd numbers from 1 to N. 4. Write a program to find the sum of first N natural numbers. 5. Write a program to calculate the factorial of a given number. 6. Write a program to find the sum of all even numbers & odd numbers from 1 to N. 7. Write a program to read N numbers from the keyboard and find their sum and average. 8. Write a program to display the multiplication table of a given integer. Practice Tasks Write C Program: 9. Write a program to print the reverse of a number. 10. Write a program to print the sum of digits in a number. 11. Write a program to display Fibonacci series up to n terms. 12. Write a program to check whether a given number is a 'Perfect' number or not. Perfect number, a positive integer that is equal to the sum of its proper divisors. The smallest perfect number is 6, which is the sum of 1, 2, and 3. 13. Write a program to determine whether a given number is prime or not. THANK YOU!