From ea4f706c5d19bf8ea012e6d1365458f1388aead2 Mon Sep 17 00:00:00 2001 From: Sharan Raj <52736403+sharan9678@users.noreply.github.com> Date: Sat, 31 Jul 2021 17:21:26 +0530 Subject: [PATCH] Update Exercise1_3.java I did this change because in the NPTEL portal the declaration of int variable t is not declared with sum by the portal, It is required to declare it separtely at the time of solving that particular problem. --- Exercise1_3.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Exercise1_3.java b/Exercise1_3.java index 7fb0def..84d14ad 100644 --- a/Exercise1_3.java +++ b/Exercise1_3.java @@ -3,8 +3,9 @@ public class Exercise1_3 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n=sc.nextInt(); - int sum=0,t; + int sum=0; //Use for or while loop do the operation + int t; for(int i=0;i<=n;i++) { t = 2*(i-1); @@ -15,4 +16,4 @@ public static void main(String[] args) { } System.out.println(sum); } -} \ No newline at end of file +}