Print the multiplication table

Example:
2 x 1 =2
2 x 2=4
2 x 3=6
2 x 4=8
2 x 5=10

etc

3 comments:

  1. #include
    main()
    {
    int m,r,p;
    scanf("%d",&m);
    for(r=1;r<=10;r++)
    {
    p=m*r;
    printf("%d*%d=%d\n",m,r,p);
    }
    printf("\n");
    }

    ReplyDelete
  2. /* multiplication table */
    /* Author name:Md-Naimul Hasan shohan */
    #include
    using namespace std;
    void mul(int n,int m)
    {
    for(int i=1;i<=m;i++)
    {
    cout<<n<<"x"<<i<<"="<<n*i<<endl;
    }
    }
    int main()
    {
    int n=2,m=10;
    mul(n,m);
    return 0;
    }

    ReplyDelete

  3. /* multiplication table using nested for loop*/
    /* Author name:Md-Naimul Hasan shohan */
    #include
    using namespace std;
    void mul()
    {
    for(int i=2;i<=2;i++)
    {
    for(int j=1;j<=10;j++)
    {
    cout<<i<<"x"<<j<<"="<<i*j<<endl;
    }
    }
    }
    int main()
    {

    mul();
    return 0;
    }

    ReplyDelete