Print Table using For Loop in C Language
Learn how to create multiplication tables easily in C programming. Our guide walks you through each step, showing you how to generate tables for any number from 1 to 10.
Whether you're new to coding or a seasoned programmer, this tutorial makes it simple to understand and apply. Start mastering C programming and make multiplication tables effortlessly!
Algorithm
1. Start
2. Declare variables: num, i, and result
3. Input the value of num (the number whose table is to be printed)
4. Set result = 0
5. For i from 1 to 10 (inclusive):
6. result = num * i
7. Print num, "*", i, "=", result
8. End
C Language
#include (<) stdio.h>
int main(){
int n;
printf("enter the number");
scanf("%d",&n);
printf("the table of %d is",n);
for(int i = 1 ; i<=10 ; i++){
printf("%d x %d = %d\n",n , i ,n*i);
}
}
No comments:
Post a Comment