Wednesday, December 2, 2015

Uri problem 1078 solve

Problem :

Multiplication Table

Adapted by Neilor Tonin, URI  Brazil
Timelimit: 1
Read an integer N (2 < N < 1000). Print the multiplication table of N.
1 x N = N      2 x N = 2N        ...       10 x N = 10N  

Input

The input is an integer (1 < < 1000).

Output

Print the multiplication table of N. like the following example.
Sample InputSample Output
1401 x 140 = 140
2 x 140 = 280
3 x 140 = 420
4 x 140 = 560
5 x 140 = 700
6 x 140 = 840
7 x 140 = 980
8 x 140 = 1120
9 x 140 = 1260
10 x 140 = 1400

Solution:

#include <stdio.h>
  
int main() {
  
   int i, j;
    char c= 'x' ;
    scanf("%d",&i);
    j=1*i;
    printf("1 x %d = %d\n",i,j);
    j=2*i;
    printf("2 x %d = %d\n",i,j);
    j=3*i;
    printf("3 x %d = %d\n",i,j);
j=4*i;
    printf("4 x %d = %d\n",i,j);
j=5*i;
    printf("5 x %d = %d\n",i,j);
j=6*i;
    printf("6 x %d = %d\n",i,j);
j=7*i;
    printf("7 x %d = %d\n",i,j);
j=8*i;
    printf("8 x %d = %d\n",i,j);
j=9*i;
    printf("9 x %d = %d\n",i,j);
j=10*i;
    printf("10 x %d = %d\n",i,j);
 
 
  
    return 0;
}

No comments:

Post a Comment