Write a program to find out the type of website from the URL: [.com – commercial website , .org – organization website , .in – Indian website]
Mon Feb 05 2024 09:16:52 GMT+0000 (Coordinated Universal Time)
Saved by
@E23CSEU1143
import java.util.*;
class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter a website: ");
String website = sc.next();
if(website.endsWith(".com")){
System.out.println("This is a commercial website");
}else if(website.endsWith(".org")){
System.out.println("This is an organization website");
}else if(website.endsWith(".in")){
System.out.println("This is an indian website");
}
}
}
content_copyCOPY
Comments