Question

PLEASE USE C AS A PROGRAMMING LANGUAGE

PLEASE USE C AS A PROGRAMMING LANGUAGE

11. Initialize a integers in the two-dimensional array testArray to the values 1 through 9 using 1 or more while loops so that the array could be visualized as: 1 2 3 LA 5 6 7 8 9 Code must compile and follow style guidelines. int Your code below here

PLEASE USE C AS A PROGRAMMING LANGUAGE

PLEASE USE C AS A PROGRAMMING LANGUAGE

PLEASE USE C AS A PROGRAMMING LANGUAGE

PLEASE USE C AS A PROGRAMMING LANGUAGE

0 0
Add a comment Improve this question Transcribed image text
Answer #1

//testArray program

#include<stdio.h>

int main()
{
   int testArray[3][3] = {1,2,3,4,5,6,7,8,9};
   int i = 0,j;
   //outer while loop for row
   printf("testArray : \n");
   while (i < 3)
   {
       //inner loop for column
       j = 0;
       while (j < 3)
       {
           printf("%d ", testArray[i][j]);
           j++;
       }
       printf("\n");
       i++;
   }

}

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

//output

testArray
1 2 3
4 5 6
7 8 9

Add a comment
Know the answer?
Add Answer to:
PLEASE USE C AS A PROGRAMMING LANGUAGE PLEASE USE C AS A PROGRAMMING LANGUAGE PLEASE USE...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • This is in java language. Please use simple java programming language. Each of the parts a....

    This is in java language. Please use simple java programming language. Each of the parts a. through c. below is preceded by a comment indicating what the code do. There is a least one problem with each section of code and it fails to do what was inte Show how to modify or rewrite the code so that it works as intended. Assume that all varia used have already been declared. а. // INTENT : given an array arr of...

  • Use c++ as programming language. The file needs to be created ourselves (ARRAYS) Write a program...

    Use c++ as programming language. The file needs to be created ourselves (ARRAYS) Write a program that contains the following functions: 1. A function to read integer values into a one-dimensional array of size N. 2. A function to sort a one-dimensional array of size N of integers in descending order. 3. A function to find and output the average of the values in a one dimensional array of size N of integers. 4. A function to output a one-dimensional...

  • C programming only please 5.2.3: Printing array elements with a for loop. Write a for loop...

    C programming only please 5.2.3: Printing array elements with a for loop. Write a for loop to print all elements in courseGrades, following each element with a space (including the last). Print forwards, then backwards. End each loop with a newline. Ex: If courseGrades = {7, 9, 11, 10}, print: 7 9 11 10 10 11 9 7 Hint: Use two for loops. Second loop starts with i = NUM_VALS - 1. (Notes) Note: These activities may test code with...

  • Please answer using C ++ programming language ONLY! We have only used <stdio.h> if that helps....

    Please answer using C ++ programming language ONLY! We have only used <stdio.h> if that helps. This is a basic course and the furthest we have gone is BASIC arrays. Write the code for the following problems using arrays. Write what would go in the “int main()” part of the program. For these problems, the entire program and program output is not needed. Just include what goes in the int main() part of the program. 1. Declare an integer array...

  • Programming language C Please go through this carefully. Needs function void add(int *a1, int n, int...

    Programming language C Please go through this carefully. Needs function void add(int *a1, int n, int *a2) Write a program addition.c that reads in an array (a1) of numbers, and creates a new array (a2) of numbers such that the first and last numbers of a1 are added and stored as the first number, the second and second-to-last numbers are added and stored as the second number, and so on. You need to check for even and odd length of...

  • Language: C++ Course: Computer Programming for Engineers Write a program that creates two 3x4 arrays of...

    Language: C++ Course: Computer Programming for Engineers Write a program that creates two 3x4 arrays of type "int". Populate each array with random integers between 1 and 9. Also ask the user to choose whether they want to add the arrays or subtract the second array from the first array. Output all three arrays in tabular form.

  • Programming language question ( please help if you can ) write a function f1() with the...

    Programming language question ( please help if you can ) write a function f1() with the following requirements (in C language): - It must define a local array of char values. The size must be adjustable via define macro. The default size could be, say, 1000. - It must also define a static int n that increments the number of activation records. - It must also define a static long int addr that stores the starting address of the array....

  • Please help me answer these questions in java programming language. Please answer it line after line...

    Please help me answer these questions in java programming language. Please answer it line after line so that I can understand please. Does it compile or not? No programming is done in this exercise, simply answer the questions asked in the code given below. class Exemple { /*Explain why this code does not compile */ public void m1() { foo(); } public int foo() throws Exception { throw new Exception(); } /*Explain why this code is not considered as good...

  • Write a program which: 1. Prints out the Multiplication Table for a range of numbers (positive...

    Write a program which: 1. Prints out the Multiplication Table for a range of numbers (positive integers). • Prompts the user for a starting number: say 'x' • Prompts the user for an ending number: say 'y' • Prints out the multiplication table of 'x' up to the number 'y' SPECIFIC REQUIREMENTS 1. You must use the following method to load the array: public static void loadArray(int table[][], int x, int y) 2. You must use the following method to...

  • it must be in C programming language , Thanks in advance! [2D array] [50 pts] In...

    it must be in C programming language , Thanks in advance! [2D array] [50 pts] In this question, you will create a 2-D array with name arr that stores the first 36 non-negative numbers (0 to 35). You have to follow the following guidelines: • You cannot manually enter all 36 numbers by hand. If you do that you will get from this part. You have to use loop/loops to define that array. (15 pts] • You should be printing...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT