1. Engineering
  2. Computer Science
  3. need some help with this programming question please screenshot you...

Question: need some help with this programming question please screenshot you...

Question details

Need some help with this programming Question

Please screenshot you output and Bold your coding. thanks  

Programming challenge Description:

Given Positive integers A, B, and N write a program that prints integers from 1 to N. But for integers that are multiples of A print ‘F’, and for multiples of B print ‘B’. For integers which are multiples of both A and B, print ‘FB.

input :

Your program should read lines of text from standard input. Each line will contain A, B, and N as space- delimited positive integers,

Test1 input

3 5 10

Output

For each line of input, print to standard output a line of space- delimited integers 1 through N, replacing integers as described above.

Expected output

1 2 F 4 B F 7 8 F B

Here are given code you need to accomplish:

process.stdin.resume();

process.stdin.setEncoding (‘utf8’);

var stdin = ‘ ’ ;

process.stdin.on (‘data’, function (chunk) {

stdin += chunk;

}).on (‘end’ , function() {

var lines = stdin.trim().split(‘\n’);

for (var i=0; i<lines.length; i++) {

process.stdout.write (write(lines[i]);

}

});

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution