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...

  • 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...

  • # ECE 445 Computer Organization # Homework 3, problem 9 # Write a MIPS assembly language...

    # ECE 445 Computer Organization # Homework 3, problem 9 # Write a MIPS assembly language program to count the number of positive values in an array of integers. # The array of integers and the array length are provided in the .data section below. # After running your code, the variable count (in memory) should contain the number of positive values in the array Insert your name here > Insert the date here > # Author: # Date: .text...

  • Use C Programming DESCRIPTION Write a program that: Creates a Dimensional, integer array that holds 8...

    Use C Programming DESCRIPTION Write a program that: Creates a Dimensional, integer array that holds 8 values Prompts the user to enter 8 integers between 0 and 20 [inclusive) and stores the data in the array Prints the data in array abng with a histogram of the data as shown below. There is no requirement to validate the data. You must use a constant to declare your array and control any loops you need Sample Output: Enter 8 integer values...

  • PLEASE HELP!!! C PROGRAMMING CODE!!! Please solve these functions using the prototypes provided. At the end...

    PLEASE HELP!!! C PROGRAMMING CODE!!! Please solve these functions using the prototypes provided. At the end please include a main function that tests the functions that will go into a separate driver file. Prototypes int R_get_int (void); int R_pow void R Jarvis int start); void R_fill_array(int arrayll, int len); void R_prt_array (int arrayl, int len) void R-copy-back (int from[], int to [], int len); int R_count_num (int num, int arrayll, int len) (int base, int ex) 3. Build and run...

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
ADVERTISEMENT