This code is in C++
Write a function named printMultTable that takes 2 integers, numValues and factor, and prints the first numValues greater than 0 that are multiples of factor, separated by SPACE. It has no return value.
printMultTable(5, 4) should print the first 5 multiples of 4,
separated by a space, which is "4 8 12 16 20"
printMultTable(3, 6) should print the first 3 multiples of 6,
separated by a space, which is "6 12 18"
#include <iostream> using namespace std; void printMultTable(int n, int m){ for(int i = 1;i<=n;i++){ cout<<(m*i)<<" "; } } int main() { printMultTable(5,4); return 0; }
void printMultTable(int n, int m){ for(int i = 1;i<=n;i++){ cout<<(m*i)<<" "; } }
Get Answers For Free
Most questions answered within 1 hours.