PAT基础编程题目-7-4 BCD解密

PAT基础编程题目-7-4 BCD解密

题目详情

题目地址:https://pintia.cn/problem-sets/14/problems/784

解答

C语言版

#include<stdio.h>
int main()
{
   
	int wrongNumber;
	scanf("%d", &wrongNumber);
	int BCD;
	BCD = wrongNumber / 16 * 10 + wrongNumber % 16;
	printf("%d", BCD);
	return 0;
}

C++版

#include<iostream>
using namespace std;
int main() {
   
	int wrongNumber;
	cin >> wrongNumber;
	cout << (wrongNumber / 16 * 10 + wrongNumber % 16);
	return 0;
}

Java版

import java.util.Scanner;
public class Main{
   

	public static void main(String[] args) {
   
		int wrongNumber = 0;
		Scanner scanner = new Scanner(System.in);
		if (scanner.hasNext()) {
   
			wrongNumber = scanner.nextInt();
		}
		scanner.close();
		System.out.println(wrongNumber / 16 * 10 + wrongNumber % 16);

	}

}

创作不易,喜欢的话加个关注点个赞,谢谢谢谢谢谢!

全部评论

相关推荐

10-28 14:42
门头沟学院 Java
watermelon1124:因为嵌入式炸了
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务