فهرس الكتباللغة البرمجية دارت

حل السؤال

حل السؤال 48

import 'dart:io';
void main() {
  stdout.write("Enter the student is year of birth: ");
  int birthyear = int.parse(stdin.readLineSync()!);
  int age = DateTime.now().year - birthyear;
  switch (age) {
    case 7:
      print("This student is $age years old and at the first grade.");
      break;
    case 8:
      print("This student is $age years old and at the second grade.");
      break;
    case 9:
      print("This student is $age years old and at the third grade.");
      break;
    case 10:
      print("This student is $age years old and at the fourth grade.");
      break;
    default:
      print("The student is not studying in primary school.");
  }
}
العودة إلى السؤال نفسه