PAT? explain more i could help
Answer: cara.
Explanation: i would pick cara because she would listen to you better and Luke try her best to get what you want!
Answer:
#include <iostream>
using namespace std;
int main() {
int a[4][5];//declaring a matrix of 4 rows and 5 columns.
for(int i=0;i<4;i++)
{
for(int j=0;j<5;j++)
{
if(i==3)//initializing last row as 0.
{
a[i][j]=0;
}
else//initializing last row as 1.
{
a[i][j]=1;
}
}
}
for(int i=0;i<4;i++)
{
for(int j=0;j<5;j++)
cout<<a[i][j]<<" ";//printing the matrix.
cout<<endl;
}
return 0;
}
Output:-
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
0 0 0 0 0
Explanation:
I have created a matrix of size 4 rows and 5 columns.I have used for loops to fill the array.To fill the last row with 0 i have used if statement.else we are filling it with 1.
The program that will print (SQUARE) of first 10 natural numbers using while loop is given below.
<h3>What is the code that returns the above result?</h3>
The program that returns the above result is:
public class KboatNaturalNumbers
{
public static void main(String args[]) {
int n = 1;
int sum = 0;
while (n <= 10) {
System.out.println(n);
sum = sum + n;
n = n + 1;
}
System.out.println("Sum = " + sum);
}
}
<h3>What is a loop?</h3>
A loop is a set of instructions that are repeatedly carried out until a specific condition is met in computer programming.
In most cases, a given procedure, such as collecting data and changing it, is followed by a condition check, such as determining whether a counter has hit a predetermined number.
Learn more about loops:
brainly.com/question/26568485
#SPJ1