Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Tạo ra một lớp lưu trữ giá trị nguyên tên myNumber. Tạo thuộc tính cho thành
- viên này. Khisố đượclưutrữthì nhân cho 100. Và khi số được truycập thìchia cho 100.*/
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace MyNumber
- {
- class My
- {
- public static void input()
- {
- number = float.Parse(Console.ReadLine());
- }
- public float Num
- {
- get
- {
- return number / 100;
- }
- set
- {
- number = value;
- number = number * 100;
- }
- }
- public private float number;
- }
- class Program
- {
- static void Main(string[] args)
- {
- My.input();
- float a=My.Num;
- Console.WriteLine("Out: {0}",a);
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement