using System;

namespace MyCompiler {
    class Program {
        public static void Main(string[] args) {
            Console.WriteLine("digite um valor para x:");
            double x = Convert.ToDouble(Console.ReadLine());
            if(x <= 1){
                Console.WriteLine("y = " + "1");
            }
            else{
             if(1 < x && x <= 2){
                Console.WriteLine("y = " + "2");
            }
            else{
             if(2 < x && x <= 3){
                Console.WriteLine("y = " + Math.Pow(x, 2));
            }
             else{
             if(x > 3){
                Console.WriteLine("y = " + Math.Pow(x, 3));
            }
        
                 }
                }
                }
            }
                }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: