PRINTTABLE Editorial

PROBLEM LINK:

[Practice](CodeChef PRINTTABLE)

Author: RushikeshThakare
Tester: NilprasadBirajdar
Editorialist: RusshikeshThakare

DIFFICULTY:

CAKEWALK.

PREREQUISITES:

Basic Math.

PROBLEM:

Given an integer, NN , print its first 1010 multiples. Each multiple NN xx ii (where 1≤i≤101≤i≤10) should be printed on a new line in the form: N x i = result.

QUICK EXPLANATION:

Print the table of given Number

SOLUTIONS:

Setter's Solution

#include
using namespace std;

int main()
{
int i,n;
for(i=1;i<=10;++i){
cin>>n;
cout<<n<<" x “<<i<<” = "<<n*i<<endl;
}
return 0;
}

Tester's Solution

#include <stdio.h>

int main(void) {
int a,i,b=0;
scanf("%d",&a);

while(b<10)
{
b++;
i=a*b;
printf("%d x %d = %d\n",a ,b ,i);
}
return 0;
}

Editorialist's Solution

#include <stdio.h>

int main(void) {
// your code goes here
int N;
scanf("%d" , &N);

for(int i=1; i<=10; i++){
    printf("%d x %d = %d\n" , N, i, N*i);
}
return 0;

}