Diễn đàn sinh viên công nghệ thông tin, chia sẻ, giao lưu, học hỏi. Kết nối ... Những ngôn ngữ cơ bản mà bạn cần phải nắm nếu muốn thành 1 lập trình viên ...VuaTenMien.Com
Thứ Hai, 11 tháng 3, 2013
Code C#: Ví dụ cấu trúc IF...ELSE
//Viết chương trình cho phép nhập 3 số nguyên từ bàn phím. In ra số lớn nhất.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Max_3_so{
class Program{
static void Main(string[] args){
int a, b, c;
Console.Write("Nhap gia tri a:");
a = int.Parse(Console.ReadLine());
Console.Write("Nhap gia tri b:");
b = int.Parse(Console.ReadLine());
Console.Write("Nhap gia tri c:");
c= int.Parse(Console.ReadLine());
if (a > b)
if (a > c) Console.Write("Gia tri lon nhat la:{0}.",a);
else Console.Write("Gia tri lon nhat la:{0}.", z);
else if (b > c) Console.Write("Gia tri lon nhat la:{0}.",b);
else Console.Write("Gia tri lon nhat la:{0}.",c);
Console.ReadLine();
}
}
}
Đăng ký:
Đăng Nhận xét (Atom)
Bài đăng phổ biến
-
import java.io.*; public class Test_Ngto{ public static void main(String args[]){ InputStream is = System.in; ...
-
import java.io.*; public class ReadLine{ public static void main(String args[]){ InputStreamReader isr = new InputStreamReader...
-
1. Hãy xây dựng lớp Diem cùng với các đối tượng điểm trong mặt phẳng và các phương thức sau: - Phương thức khởi tạo - Phương...
-
<html> <head> <title>Giai phuong trinh bac 2</title> <script language="JavaScript"> function giai(fo...
-
import java.io.*; public class Test_Tng{ public static void main(String args[]){ InputStream is = System.in; ...
-
<%@ Page Language="VB" Debug="true" %> <%@ Import Namespace="System.Data" %> <%@ Import Namespa...
-
<html> <head><script LANGUAGE="JavaScript"> function a_plus_b(form) { a=eval(form.a.value) ...
-
import java.io.*; public class Gptb2{ public static void main(String args[]){ InputStreamReader isr = new InputStream...
-
<html> <head> <title>giai phuong trinh bac 1</title> <script language="JavaScript"> function giai(fo...
-
<%@ Page Language="VB" Debug="true" %> <%@ Import Namespace="System.Data" %> <%@ Import Namespa...
Không có nhận xét nào:
Đăng nhận xét