From b3d436bfd49a716f1cb83c237f0efcaada3330b1 Mon Sep 17 00:00:00 2001 From: vns <144002700+vnsidd@users.noreply.github.com> Date: Fri, 5 Jan 2024 08:45:05 +0530 Subject: [PATCH] Update azure-pipelines.yml for Azure Pipelines --- azure-pipelines.yml | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d7f1a35..8e349f4 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,23 +1,27 @@ -#include +import java.util.Scanner; -int main() { - // Declare variables to store the numbers - int num1, num2, sum; +public class AddTwoNumbers { + public static void main(String[] args) { + // Create a Scanner object to get input from the user + Scanner scanner = new Scanner(System.in); - // Get input from the user - printf("Enter first number: "); - scanf("%d", &num1); + // Declare variables to store the numbers + int num1, num2, sum; + System.out.print("Enter first number: "); + num1 = scanner.nextInt(); - printf("Enter second number: "); - scanf("%d", &num2); + System.out.print("Enter second number: "); + num2 = scanner.nextInt(); - // Add the numbers - sum = num1 + num2; + // Add the numbers + sum = num1 + num2; - // Display the result - printf("Sum: %d\n", sum); + // Display the result + System.out.println("Sum: " + sum); - return 0; + // Close the scanner to avoid resource leak + scanner.close(); + } }