Coding | Mcqs | Multiple choice questions | Informative | Computer Science | Engineering | Aptitude | Quants | Verbal

INFEED

C - VERY-EASY - PART004-Print first X multiples

 A number N is passed as input. Another number X is also passed as input. The program must print first X multiples of the number N.


Input Format:

The first line denotes the value of N

The second line denotes the value of X


Output Format:

The first X multiples of N, each separated by a space.


Boundary Conditions:

1 <= N <= 999999

1 <= X <= 1000


Example Input/Output 1:

Input:

4

6


Output:

4 8 12 16 20 24


Example Input/Output 2:

Input:

22

3


Output:

22 44 66

Code:

#include<stdio.h>

#include<stdlib.h>


int main()

{int a,b;

scanf("%d %d",&a,&b);

int x=0;

for(int i=0;i<b;i++)

{

    x+=a;

    printf("%d ",x);

}

}

Post a Comment

Previous Post Next Post