Question

For any element in keysList with a value greater than 50. print the corresponding value in itemsList, followed by a comma (no
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Source Code:

#include <stdio.h>

int main(void)
{
   const int SIZE_LIST=4;
   int keyList[SIZE_LIST];
   int itemList[SIZE_LIST];
   int i;

   scanf("%d",&keyList[0]);
   scanf("%d",&keyList[1]);
   scanf("%d",&keyList[2]);
   scanf("%d",&keyList[3]);

   scanf("%d",&itemList[0]);
   scanf("%d",&itemList[1]);
   scanf("%d",&itemList[2]);
   scanf("%d",&itemList[3]);

   for(i=0;i<SIZE_LIST;i++)
   {
       if(keyList[i]>50)
           printf("%d,",itemList[i]);
   }
   printf("\n");

   return 0;
}

1 #include <stdio.h> 2 3 int main(void) 4 { 5 const int SIZE_LIST=4; 6 int keyList[SIZE_LIST]; 7 int itemList[SIZĒ_LIST]; 8 i

Sample input and output:

(base) rgukt1@rgukt-TravelMate-P243-M:~/Desktops /a.out 32 105 101 35 10 20 30 40 20,30, (base) rgukt1@rgukt-TravelMate-P243-

Add a comment
Know the answer?
Add Answer to:
For any element in keysList with a value greater than 50. print the corresponding value in...
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
  • For any element in keysList with a value smaller than 60, print the corresponding value in...

    For any element in keysList with a value smaller than 60, print the corresponding value in itemsList, followed by a space. Ex: If keysList = {32, 105, 101, 35} and itemsList = {10, 20, 30, 40}, print: 10 40 import java.util.Scanner; public class ArraysKeyValue {    public static void main (String [] args) {       final int SIZE_LIST = 4;       int[] keysList = new int[SIZE_LIST];       int[] itemsList = new int[SIZE_LIST];       int i;       keysList[0] = 13;      ...

  • Double any element's value that is less than minVal. Ex: If minVal = 10, then dataPoints...

    Double any element's value that is less than minVal. Ex: If minVal = 10, then dataPoints = {2, 12, 9, 20} becomes {4, 12, 18, 20}. #include <stdio.h> int main(void) { const int NUM_POINTS = 4; int dataPoints[NUM_POINTS]; int minVal; int i; dataPoints[0] = 2; dataPoints[1] = 12; dataPoints[2] = 9; dataPoints[3] = 20; minVal = 10; /* Your solution goes here */ for (i = 0; i < NUM_POINTS; ++i) { printf("%d ", dataPoints[i]); } printf("\n"); return 0; }

  • C - Language Write a loop that sets each array element to the sum of itself...

    C - Language Write a loop that sets each array element to the sum of itself and the next element, except for the last element which stays the same. Be careful not to index beyond the last element. Ex: Initial scores: 10, 20, 30, 40 Scores after the loop: 30, 50, 70, 40 The first element is 30 or 10 + 20, the second element is 50 or 20 + 30, and the third element is 70 or 30 +...

  • for c CHALLENGE ACTIVITY 9.7.1: Decrement array elements. Write a loop that subtracts 1 from each...

    for c CHALLENGE ACTIVITY 9.7.1: Decrement array elements. Write a loop that subtracts 1 from each element in lowerScores. If the element was already 0 or negative, assign 0 to the element. Ex lowerScores = {5,0,2,-3) becomes {4.0, 1.0). 1 include <stdio.h> 3 int main(void) 0 const int SCORES_SIZE - 4; int lowerScores [SCORES_SIZE]: int i; for (1 - 0; i < SCORES_SIZE; ++) { scanf("%d", &(lowerScores[i])); /" Your solution goes here / { 15 for (i = 0; i...

  • C code Given numRows and numColumns, print a list of all seats in a theater. Rows...

    C code Given numRows and numColumns, print a list of all seats in a theater. Rows are numbered, columns lettered, as in 1A or 3E. Print a space after each seat, including after the last. Ex: numRows = 2 and numColumns = 3 prints: 1A 1B 1C 2A 2B 2C #include <stdio.h> int main(void) { int numRows; int numColumns; int currentRow; int currentColumn; char currentColumnLetter; scanf("%d", &numRows); scanf("%d", &numColumns); /* Your solution goes here */ printf("\n"); return 0; }

  • IN C PLEASE Find the maximum value and minimum value in miles Tracker. Assign the maximum...

    IN C PLEASE Find the maximum value and minimum value in miles Tracker. Assign the maximum value to maxMiles, and the minimum value to minMiles. Sample output for the given program: Min miles: -10 Max miles: 40 (Notes) 1 tes pass ㄷ Alltes int j; 1 #include <stdio.h> 2 3 int main(void) { 4 const int NUM_ROWS = 2; 5 const int NUM_COLS = 2; 6 int milesTracker [NUM_ROWS] [NUM_COLS]; 7 int i; 8 9 int maxMiles = 0; //...

  • Use only C Program for this problem. Must start with given codes and end with given...

    Use only C Program for this problem. Must start with given codes and end with given code. CHALLENGE ACTIVITY 9.4.3: Input parsing: Reading multiple items. Complete scanf( to read two comma-separated integers from stdin. Assign userlnt1 and userInt2 with the user input. Ex: "Enter two integers separated by a comma: 3,5", program outputs: 3 + 5 = 8 1 #include <stdio.h> HNM 1 test passed int main(void) { int user Int1; int user Int2; All tests passed 000 printf("Enter two...

  • CHALLENGE ACTIVITY 5.71 String library functions. Assign the size of userinput to stringSize. Ex: if userinput...

    CHALLENGE ACTIVITY 5.71 String library functions. Assign the size of userinput to stringSize. Ex: if userinput is 'Hello output is: Size of user Input: 5 1 #include <stdio.h> 2 #include <string.h> 4 int main(void) { char user Input[50]; int stringSize; BO scanf("%s", userInput); /* Your solution goes here" printf("Size of user Input: %d\n", stringsize); return ; Run

  • #include<stdio.h> int main() { int i; printf("Type an integer value: "); scanf("%d",&i); evaluate(i); return(0); } void...

    #include<stdio.h> int main() { int i; printf("Type an integer value: "); scanf("%d",&i); evaluate(i); return(0); } void evaluate(int x) { if(x > 10) printf("Value entered by you is greater than 10"); else if(x < 10) printf("Value entered by you is less than 10"); else printf("Value entered by you is equal 10"); } _______________________________________ report for this in hr ?

  • Fix the errors in C code #include <stdio.h> #include <stdlib.h> void insertAt(int *, int); void Delete(int...

    Fix the errors in C code #include <stdio.h> #include <stdlib.h> void insertAt(int *, int); void Delete(int *); void replaceAt(int *, int, int); int isEmpty(int *, int); int isFull(int *, int); void removeAt(int *, int); void printList(int *, int); int main() { int *a; int arraySize=0,l=0,loc=0; int choice; while(1) { printf("\n Main Menu"); printf("\n 1.Create list\n 2.Insert element at particular position\n 3.Delete list.\n4. Remove an element at given position \n 5.Replace an element at given position\n 6. Check the size of...

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