0 like 0 dislike
582 views

Please fix the following code below to receive 5 inputs then outputs the maximum number:

CODE

#include <stdio.h>

int main(){
	int number[$1],max=0;
	
	for(int i=0;i<5;i++){
	scanf("%d",$2);
		if(number[i]>$3){
		max = $4;
		}
	}
	
	printf("\nThe maximum number is %d",$5);
		
	return 0;
}

 

OUTPUT 1

33 5555 22 44 453

The maximum number is 5555

 

OUTPUT 2

1 3 4 7 2

The maximum number is 7
[Exercise] Fill in the blank - asked in Chapter 4: Arrays by (5.9k points)
ID: 37578 - Available when: Unlimited - Due to: Unlimited
| 582 views

20 Answers

0 like 0 dislike
Hidden content!
5
** *

* * **

max
100/100 answered by (273 points)
edited by
0 like 0 dislike
Hidden content!
5
*** ** * *
**
* ***

max
100/100 answered by (290 points)
0 like 0 dislike
Hidden content!
5
*** **
*
** ** *

max
100/100 answered by (269 points)
0 like 0 dislike
Hidden content!
5
* ** * *
*
****

max
100/100 answered by (220 points)
0 like 0 dislike
Hidden content!
5
* ** *
*
**

max
100/100 answered by (283 points)
edited by
0 like 0 dislike
Hidden content!
5
** **
*
**

max
100/100 answered by (254 points)
edited by
0 like 0 dislike
Hidden content!
5
*** * * **
*
*** *

max
100/100 answered by (153 points)
edited by
0 like 0 dislike
Hidden content!
5
****** ** ***
*
*****

max
100/100 answered by (271 points)
0 like 0 dislike
Hidden content!
5
* ** **
* *
* ** *

max
100/100 answered by (252 points)
0 like 0 dislike
Hidden content!
5
** * * * **
***
* *

max
answered
reshown by
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.58.105
©2016-2024

Related questions

0 like 0 dislike
18 answers
[Exercise] Fill in the blank - asked Dec 7, 2017 in Chapter 4: Arrays by nat236919 (5.9k points)
ID: 35798 - Available when: Unlimited - Due to: Unlimited
| 510 views
0 like 0 dislike
18 answers
[Exercise] Coding (C) - asked Jan 5, 2018 in Chapter 4: Arrays by nat236919 (5.9k points)
ID: 41054 - Available when: Unlimited - Due to: Unlimited
| 1.2k views
0 like 0 dislike
46 answers
[Exercise] Coding (C) - asked Dec 15, 2017 in Chapter 4: Arrays by nat236919 (5.9k points)
ID: 37580 - Available when: Unlimited - Due to: Unlimited
| 1.7k views
0 like 0 dislike
17 answers
[Exercise] Coding (C) - asked Dec 7, 2017 in Chapter 4: Arrays by nat236919 (5.9k points)
ID: 35804 - Available when: Unlimited - Due to: Unlimited
| 780 views
0 like 0 dislike
0 answers
[Resource] asked Jan 5, 2018 in Chapter 4: Arrays by nat236919 (5.9k points)
ID: 41053 - Available when: Unlimited - Due to: Unlimited
| 13 views
12,783 questions
183,443 answers
172,219 comments
4,824 users