From 818e0d8e63707fe57f69a97195f9898aa836ccfd Mon Sep 17 00:00:00 2001 From: siddhardhas <72202100+siddhardhas@users.noreply.github.com> Date: Sun, 4 Oct 2020 16:44:16 +0530 Subject: [PATCH 1/3] Create Employeesdetails.c --- Employeesdetails.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Employeesdetails.c diff --git a/Employeesdetails.c b/Employeesdetails.c new file mode 100644 index 0000000..5d588a1 --- /dev/null +++ b/Employeesdetails.c @@ -0,0 +1,28 @@ + +#include + + +struct employee{ + char name[30]; + int empId; + float salary; +}; + +int main() +{ + + struct employee emp; + + + printf("\nEnter details :\n"); + printf("Name ?:"); gets(emp.name); + printf("ID ?:"); scanf("%d",&emp.empId); + printf("Salary ?:"); scanf("%f",&emp.salary); + + + printf("\nEntered detail is:"); + printf("Name: %s" ,emp.name); + printf("Id: %d" ,emp.empId); + printf("Salary: %f\n",emp.salary); + return 0; +} From 9549299e2409a0e62c6e6337ded052a98045abe5 Mon Sep 17 00:00:00 2001 From: siddhardhas <72202100+siddhardhas@users.noreply.github.com> Date: Sun, 4 Oct 2020 20:50:43 +0530 Subject: [PATCH 2/3] Create Multiplecatchblock.Java --- Multiplecatchblock.Java | 57 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Multiplecatchblock.Java diff --git a/Multiplecatchblock.Java b/Multiplecatchblock.Java new file mode 100644 index 0000000..d36f016 --- /dev/null +++ b/Multiplecatchblock.Java @@ -0,0 +1,57 @@ +import java.util.*; + +public class MyClass { + + public static void main(String[] args) { + + int a, b, div; + + Scanner s = new Scanner(System.in); + + try + + { + + System.out.println("Enter 1st number: "); + + a = s.nextInt(); + + System.out.println("Enter 2nd number: "); + + b = s.nextInt(); + + div = a / b; + + System.out.println("The answer is: " + div); + + } + + catch(ArithmeticException e) + + { + + System.out.println("Arithmetic Exception! You're dividing by zero."); + + } + + catch(NumberFormatException e) + + { + + System.out.println("You entered a non-numerical value."); + + } + + catch(Exception e) + + + + { + + System.out.println(e); + + } + + } + +} From 51c8e84d1517267b17666563d1394f2e19b8440f Mon Sep 17 00:00:00 2001 From: siddhardhas <72202100+siddhardhas@users.noreply.github.com> Date: Sun, 4 Oct 2020 20:51:32 +0530 Subject: [PATCH 3/3] Create Multipleblock.Java --- Multipleblock.Java | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Multipleblock.Java diff --git a/Multipleblock.Java b/Multipleblock.Java new file mode 100644 index 0000000..5c00d98 --- /dev/null +++ b/Multipleblock.Java @@ -0,0 +1,37 @@ +import java.util.*; +public class MyClass { + public static void main(String[] args) + { + int a, b, div; + Scanner s = new Scanner(System.in); + + try + { + System.out.println("Enter 1st number: "); + a = s.nextInt(); + + System.out.println("Enter 2nd number: "); + b = s.nextInt(); + + div = a / b; + + System.out.println("The answer is: " + div); + } + + catch(ArithmeticException e) + { + System.out.println("Arithmetic Exception! You're dividing by zero."); + } + + catch(NumberFormatException e) + { + System.out.println("You entered a non-numerical value."); + } + + catch(Exception e) + + { + System.out.println(e); + } + } +}