Added output of characters

Source: Internet
Author: User

Design ideas:

<1> declaring string characters, defining variables;

<2> enter characters from the keyboard;

<3> defines shaping numbers, converts characters into numbers, and assigns values to defined shaping;

<4> The addition operation of the number, ending.

Import Java.util.Scanner;

public class Example {

public static void Main (String args[]) {

String STR1,STR2,STR3; Definition of a string

System.out.println ("Please enter 3 numeric characters:");//input of a string

Scanner reader=new Scanner (system.in);

Str1=reader.next ();

Str2=reader.next ();

Str3=reader.next ();

System.out.println ("Three characters in turn:");

System.out.println (STR1);//output of string

System.out.println (STR2);

System.out.println (STR3);

The definition of an int num1,num2,num3;//integer

SYSTEM.OUT.PRINTLN ("The result of conversion to a number is:");

Num1=integer.parseint (STR1);//conversion of array characters to numbers

Num2=integer.parseint (STR2);

Num3=integer.parseint (STR3);

System.out.println (NUM1);//output of digital

System.out.println (NUM2);

System.out.println (NUM3);

The addition of the int sum;//number

SUM=NUM1+NUM2+NUM3;

System.out.println ("Three numbers Add the result:" +sum);

}

}

Added output of characters

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.