java作業 2.6

//程序猿:孔宏旭? 2017.X.XX

/**功能:在鍵盤輸入一個三位數,求它們的各數位之和。

*1、使用Scanner關鍵字來實現從鍵盤輸入的方法。

*2、使用取余的方法將各個數位提取出來。

*3、最后將得到的各個數位相加。

*/

import java.util.Scanner;

?

public class Num

{ ?

  public static void main(String[] args)

  { ?

?    Scanner input = new Scanner(System.in);

?    System.out.println("請輸入一個大于0小于1000的整數:");

     int x=input.nextInt();?

     int a= x/100;??

?    int b= (x/10)%10; ?

??????    ?int c= x%10;

??    System.out.println("三數相加結果是:" + (a+b+c)); ?

  }

}

轉載于:https://www.cnblogs.com/kon-kon/p/7541460.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/391362.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/391362.shtml
英文地址,請注明出處:http://en.pswp.cn/news/391362.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

ubuntu 16.04 掛載新硬盤

2、掛載數據盤 mkdir /datausrubuntu:~$ lsblkNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTsda 8:0 0 465.8G 0 disk sda1 8:1 0 512M 0 part /boot/efisda2 8:2 0 464.3G 0 part /sda3 8:3 0 976…

Go語言實戰 : API服務器 (2) 運行流程

1.API服務器的總流程 分為兩步: 啟動API服務器API服務器對HTTP請求進行處理 2.API服務器啟動流程 解析配置文件,利用配置文件完成對服務器的初始化配置初始化logger,開啟日志記錄與數據庫建立連接設置http連接(例如設置響應頭…

Linux 命令 之查看程序占用內存

2019獨角獸企業重金招聘Python工程師標準>>> 查看PID ps aux | grep nginx root 3531 0.0 0.0 18404 832 ? Ss 15:29 0:00 nginx: master process ./nginx 查看占用資源情況 pmap -d 3531 top -p 3531 轉載于:https://my.oschina.net/mengzha…

邏輯回歸 自由度_回歸自由度的官方定義

邏輯回歸 自由度Back in middle and high school you likely learned to calculate the mean and standard deviation of a dataset. And your teacher probably told you that there are two kinds of standard deviation: population and sample. The formulas for the two a…

動畫電影的幕后英雄怎么說好_幕后編碼面試-好與壞

動畫電影的幕后英雄怎么說好Interviewing is a skill in and of itself. You can be the best developer in the world but you may still screw up an interview.面試本身就是一種技能。 您可以成為世界上最好的開發人員,但您仍可能會搞砸面試。 How many times h…

數據庫之DML

1、表的有關操作: 1.1、表的創建格式: CREATE TABLE IF NOT EXISTS 表名(屬性1 類型,屬性2 類型,....,屬性n 類型);# 標記部分表示可以省略 1.2、表的修改格式:ALTER table 表名 ADD…

網絡對抗技術作業一 201421410031

姓名:李冠華 學號:201421410031 指導教師:高見 1、虛擬機安裝與調試 安裝windows和linux(kali)兩個虛擬機,均采用NAT網絡模式,查看主機與兩個虛擬機器的IP地址,并確保其連通性。同時…

生存分析簡介:Kaplan-Meier估計器

In my previous article, I described the potential use-cases of survival analysis and introduced all the building blocks required to understand the techniques used for analyzing the time-to-event data.在我的上一篇文章中 ,我描述了生存分析的潛在用例…

強密碼檢測

#!/usr/bin/env python # -*- coding: utf-8 -*- #1. 密碼長度應該大于或等于8位 #2. 密碼必須包含數字、字母及特殊字符三種組合 nums 0123456789 chars1 abcdefghijklmnopqrstuvwxyz chars2 ABCDEFGHIJKLMNOPQRSTUVWXYZ symbols r!#$%^&*()_-/*{}[]\|";:/?…

OD Linux發行版本

題目描述: Linux操作系統有多個發行版,distrowatch.com提供了各個發行版的資料。這些發行版互相存在關聯,例如Ubuntu基于Debian開發,而Mint又基于Ubuntu開發,那么我們認為Mint同Debian也存在關聯。 發行版集是一個或多…

Go語言實戰 : API服務器 (3) 服務器雛形

簡單API服務器功能 實現外部請求對API 服務器健康檢查和狀態查詢,返回響應結果 1.API服務器的狀態監測 以內存狀態檢測為例,獲取當前服務器的健康狀況、服務器硬盤、CPU 和內存使用量 func RAMCheck(c *gin.Context) {u, _ : mem.VirtualMemory()//獲…

TCP/IP協議-1

轉載資源,鏈接地址https://www.cnblogs.com/evablogs/p/6709707.html 轉載于:https://www.cnblogs.com/Chris-01/p/11474915.html

http://nancyfx.org + ASPNETCORE

商務產品servicestack: https://servicestack.net/ http://nancyfx.org ASPNETCORE http://nancyfx.org Drapper ORM精簡框架 https://github.com/StackExchange/Dapper Nancy 是一個輕量級用于構建基于 HTTP 的 Web 服務,基于 .NET 和 Mono 平…

使用r語言做garch模型_使用GARCH估計貨幣波動率

使用r語言做garch模型Asset prices have a high degree of stochastic trends inherent in the time series. In other words, price fluctuations are subject to a large degree of randomness, and therefore it is very difficult to forecast asset prices using traditio…

ARC下的內存泄漏

##ARC下的內存泄漏 ARC全稱叫 ARC(Automatic Reference Counting)。在編譯期間,編譯器會判斷對象的使用情況,并適當的加上retain和release,使得對象的內存被合理的管理。所以,從本質上說ARC和MRC在本質上是一樣的,都是…

python:校驗郵箱格式

# coding:utf-8import redef validateEmail(email):if re.match("^.\\(\\[?)[a-zA-Z0-9\\-\\.]\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$", email) ! None:# if re.match("/^\w[a-z0-9]\.[a-z]{2,4}$/", email) ! None:print okreturn okelse:print failret…

cad2019字體_這些是2019年最有效的簡歷字體

cad2019字體When it comes to crafting the perfect resume to land your dream job, you probably think of just about everything but the font. But font is a key part of your first impression to recruiters and employers.當制作一份完美的簡歷來實現理想的工作時&…

Go語言實戰 : API服務器 (4) 配置文件讀取及連接數據庫

讀取配置文件 1. 主函數中增加配置初始化入口 先導入viper包 import (..."github.com/spf13/pflag""github.com/spf13/viper""log")在 main 函數中增加了 config.Init(*cfg) 調用,用來初始化配置,cfg 變量值從命令行 f…

方差偏差權衡_偏差偏差權衡:快速介紹

方差偏差權衡The bias-variance tradeoff is one of the most important but overlooked and misunderstood topics in ML. So, here we want to cover the topic in a simple and short way as possible.偏差-方差折衷是機器學習中最重要但被忽視和誤解的主題之一。 因此&…

win10 uwp 讓焦點在點擊在頁面空白處時回到textbox中

原文:win10 uwp 讓焦點在點擊在頁面空白處時回到textbox中在網上 有一個大神問我這樣的問題:在做UWP的項目,怎么能讓焦點在點擊在頁面空白處時回到textbox中? 雖然我的小伙伴認為他這是一個 xy 問題,但是我還是回答他這個問題。 首…