Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(USING VISUAL STUDIOS) Multiplication Table Write a program that uses a nested l

ID: 3870554 • Letter: #

Question

(USING VISUAL STUDIOS)

Multiplication Table    Write a program that uses a nested loop to print out a 10x10 multiplication table. Make sure the columns are right-aligned.

Hint: print out (row+1)*(col+1) while your loop indices row & col go from 0 to 9

-------------------------------------------------------------------------------------------------------------------------------

•PE 1 Loops & Arrays (Enhanced)    Write a program that creates a char array with 26 elements. Then use a while() loop to put the 26 lowercase letters in it, and a for() loop to print the array contents, as shown below:

}The array contents:

}array[0]=a

}array[1]=b

}array[2]=c

}array[3]=d

}…

}array[25]=z

}Hint: to fill the array, note that the alphabetical char values are numerically adjacent, so

}         ‘a’+ 1 == ‘b’

Explanation / Answer

1.

#include <iostream>

using namespace std;

int main() {

int row,col;

for(row=0;row<10;row++)

{

for(col=0;col<10;col++)

{

cout<<(row+1)*(col+1)<<" "; // multiply row and col

}

cout<<endl;

}

return 0;

}

output:

2.

#include <iostream>

using namespace std;

int main() {

char arr[26];

char c = 'a';

  

int i = 0;

while(i<26)

{

arr[i] = c; //arr[0] = a

i++; // increment counter

c++; //increment the value of c , if c = a,c++ = b,c++ = c...........

}

for(i=0;i<26;i++)

cout<<arr[i]<<" ";

return 0;

}

Output: