(Syntax) Select the largest number from N (change)

Source: Internet
Author: User

Knowledge point:

Understand the programming sequence and use scanf () flexibly ()

Int A [1000], I, m = 1; char B [1000]; for (I = 0; I <1000; I ++) {scanf ("% d ", & A [I]); scanf ("% C", & B [I]);

The ascll code ending with the Space key is 010. The ascll code of the original carriage return key is 13, but in the program press the carriage return key is a line feed, so the ascll code of the line feed is used to control the end of the program.

If (B [I]! = 10)

Tip: use integer Array Operations to stop character array control

 

 

Content: select the maximum number from N.

Input description:

One row, multiple integers, separated by Spaces

Output description:

Two integers. The first is the total number of digits, and the second is the maximum number. Separated by Spaces

 

Input example:

1 2 3 4 5 9 6

Output example:

7 9

 

#include <stdio.h>int main(){ int a[1000],i,m=1; char b[1000]; for (i=0;;i++) {  scanf("%d",&a[i]);  scanf("%c",&b[i]);  if(a[0]<a[i])  {   a[0]=a[i];  }  if (b[i]!=10)  {   m+=1;  }  else   {   break;  } } printf("%d %d\n",m,a[0]); return 0;}

 

(Syntax) Select the largest number from N (change)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.