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...

C programmes for practice

Mathematics & Number Theory

1. Find GCD using recursion


2. Check whether a number is an Armstrong number


3. Generate Pascal’s Triangle


4. Find LCM without using loops


5. Implement Sieve of Eratosthenes for prime generation


6. Fast exponentiation (power in log(n))


7. Modular exponentiation


8. Check if a number is a strong number


9. Compute large factorial using array


10. Check if a number is automorphic

Comments

Popular posts from this blog

python in brief

advance loop based C programmes