Question

In: Computer Science

Write a declaration to store the following values in an array rates : 12.9, 28.6, 11.4,...

Write a declaration to store the following values in an array rates : 12.9, 28.6, 11.4, 13.7, 9.5, 15.2, and 17.6. Include the declaration in a program that displays the values in the array by using pointer offset notation

Solutions

Expert Solution

#include<stdio.h>

int main(){
  
   float rate [] = {12.9, 28.6, 11.4, 13.7, 9.5, 15.2, 17.6}; //declaration to store the values
   int i;
   for(i=0;i<7;i++)
       printf("%.1f ",*(rate+i)); //pointer offset notation to display the values
      
   return 0;
}

Output

NOTE: If you want to change something , please let me know through comments; I will surely revert back to you.

Please give a up vote .....
Thank you...


Related Solutions

Given the following variable declarations: const size_t n = 50; Write the declaration of an array...
Given the following variable declarations: const size_t n = 50; Write the declaration of an array of pointers to n memory blocks containing 16-bit signed integer values. Use 'x' for the name of the variable. (Don't forget the semi-colon at the end of the declaration!)
write a function declaration for a 2d array where each row size is 8 and the...
write a function declaration for a 2d array where each row size is 8 and the function does not return anything.
Write a function declaration for a function that sums each row of a 2D array, where...
Write a function declaration for a function that sums each row of a 2D array, where each row size is 10. The function does not return a result. IN C Program.
Write a function declaration for a function that sums each row of a 2D array, where...
Write a function declaration for a function that sums each row of a 2D array, where each row size is 10. The function does not return a result. Need it in 10 minutes, please.
Write program to store ten integers in an array and the program will do the following...
Write program to store ten integers in an array and the program will do the following Find the average of even marks Find how many prime integers inserted Note: please solve it by c , not c++
Write a method with the following header to return an array of integer values which are...
Write a method with the following header to return an array of integer values which are the largest values from each row of a 2D array of integer values public static int[] largestValues(int[][] num) For example, if the 2D array passed to the method is: 8 5 5 6 6 3 6 5 4 5 2 5 4 5 2 8 8 5 1 6 The method returns an array of integers which are the largest values from each row...
Given the following processing array declaration with initialisation: int[][] foo = {{1,2,3,4,5},{2,3,4,5,6},{3,4,5,6,7},{4,5,6,7,8}}; Write a loop that...
Given the following processing array declaration with initialisation: int[][] foo = {{1,2,3,4,5},{2,3,4,5,6},{3,4,5,6,7},{4,5,6,7,8}}; Write a loop that will modify  foo so it instead contains the values {{1,4,9,16,25},{4,9,16,25,36},{9,16,25,32,49},{16,25,32,49,64}}.
Write an assembly program that rearrange the values in the following array as 40, 30, 20,...
Write an assembly program that rearrange the values in the following array as 40, 30, 20, 10: .data byte1 BYTE 10, 20, 30, 40 Save the original four byte data into eax, and the rearranged data into ebx, from the least significant bit to the most significant bit. Insert a call DumpRegs statement to display the register values.
Consider a 5-by-20 integer array grades: a) Write a declaration for grades. b) How many rows...
Consider a 5-by-20 integer array grades: a) Write a declaration for grades. b) How many rows does the array have? c) How many columns does the array have? d) How many elements does the array have? e) Write the names of all elements in the first column of the array. f) Write the name of the element in the third row and second column of the array. g) Write a single statement to assign the value 100 to the element...
Java programming language Array - Single identifier which can store multiple values Example initialized with values:...
Java programming language Array - Single identifier which can store multiple values Example initialized with values: int[] mySimpleArray = {4, 17, 99}; Example with fixed length but no values: int[] myFixedArray = new int[11]; The brackets identify the index. Each value has its own index number. NOTE: First element is the zeroth element: mySimpleArray[0] is 4, [1] is 17 Make a new Netbeans project called ArraysAndLoops Create the simple array with 4, 17, 99. Use System.out.println with the variable with...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT