My first table code and I learned after that

 #include <stdio.h>

/*  Print the table entered by the user */
int main()
int a;
   printf("Enter The desire no. of which you want the table:\n");
   scanf("%d",&a);
/*int printf(const char *, ...)*/
printf("Table of desire no is %d:\n",a);
   printf("%dx1=%d\n",a,a*1);
   printf("%dx2=%d\n",a,a*2);
   printf("%dx3=%d\n",aa*3);
   printf("%dx4=%d\n",aa*4);
   printf("%dx5=%d\n",a,a*5);
   printf("%dx6=%d\n",a,a*6);
   printf("%dx7=%d\n",a,a*7);
   printf("%dx8=%d\n",a,a*8);
   printf("%dx9=%d\n",a,a*9);
   printf("%dx10=%d\n",a,a*10);
   
    return 0;
}


/*What I learned */


#include<stdio.h>

int main(){
    int num;
    // Take the number as an input from the user
    printf("Enter the value of number whose multiplication table is to be printed\n");
    scanf("%d", &num);
    printf("The multiplication table of %d is\n"num);
     for (int i = 0i < 10i++)
     {
         printf("%d X %d = %d\n",numi+1, (i+1)*num);
     }
    
    return 0;
}


Comments

Popular posts from this blog

Maths Unit 1 ( Theory )

Intelligence System notes part 2

code for find the determinant of 3x3 matrix