Using for loop c programmes

Great! Practicing for loops in C is an excellent way to strengthen your understanding of programming logic and structure. Here are 10 C programming exercises using for loops for practice, from beginner to intermediate level: --- ✅ 1. Print Numbers from 1 to N Goal: Input n and print numbers from 1 to n. int n; printf("Enter a number: "); scanf("%d", &n); for (int i = 1; i <= n; i++) {     printf("%d ", i); } --- ✅ 2. Sum of First N Natural Numbers Goal: Input n, output sum 1 + 2 + ... + n. int n, sum = 0; printf("Enter a number: "); scanf("%d", &n); for (int i = 1; i <= n; i++) {     sum += i; } printf("Sum = %d\n", sum); --- ✅ 3. Factorial of a Number Goal: Input n, calculate n!. int n, fact = 1; printf("Enter a number: "); scanf("%d", &n); for (int i = 1; i <= n; i++) {     fact *= i; } printf("Factorial = %d\n", fact); --- ✅ 4. Multiplication Table Goal: Input n, print tabl...

advance loop based C programmes






🔍 If-Else Based Advanced Programs

1. Check if a year is a leap year using nested if-else


2. Find the largest of 4 numbers using multiple if-else


3. Check whether a character is vowel or consonant


4. Menu-driven calculator using if-else


5. Check grade based on marks (90+ = A, etc.)


6. Classify triangle (Equilateral/Isosceles/Scalene)


7. Check if a number is perfect (sum of divisors = number)


8. Check if three sides form a valid triangle


9. Check whether a point lies in which quadrant


10. Determine eligibility for job based on age, qualification



🔁 While Loop Based Advanced Programs

11. Reverse digits of a number using while loop


12. Check if a number is palindrome using while loop


13. Find GCD of two numbers using while


14. Print digits in reverse order with while


15. Find sum of even and odd digits separately


16. Generate a number pyramid using while loops


17. Check Armstrong number using while loop


18. Convert a decimal number to binary using while


19. Print Fibonacci series using while loop


20. Count digits of a number using while loop

Comments

Popular posts from this blog

python in brief