Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

02/07/2020 Programming in Java - Course

(https://swayam.gov.in) (https://swayam.gov.in/nc_details/NPTEL)

reviewer4@nptel.iitm.ac.in 

NPTEL (https://swayam.gov.in/explorer?ncCode=NPTEL) » Programming in Java (course)

Announcements (announcements)

About the Course (https://swayam.gov.in/nd1_noc20_cs08/preview) Ask a Question (forum)

Progress (student/home) Mentor (student/mentor)

Java Week 1:Q3


Course Due on 2020-02-13, 23:59 IST
outline
Consider first n even numbers starting from zero(0).Complete the code segment
to calculate sum of all these numbers divisible by 3 . Print the sum.
How does an
NPTEL online Example:
course work?
Input: n = 5
Week 0 :
-------
Week 1 : 02468
Even number divisible by 3:0 6
Lecture 01 :
sum:6
Introduction
(unit?
Sample Test Cases
unit=2&lesson=15)
Input Output
Lecture 02 :
Java Test Case 1 1 0
Programming
Steps (unit? Test Case 2 2 0
unit=2&lesson=16)

Lecture 03 : Test Case 3 10 36


Java Tools and
Resources
(unit? The due date for submitting this assignment has passed.
unit=2&lesson=17) As per our records you have not submitted this assignment.
Sample solutions (Provided by instructor)
Lecture 04 :
Demonstration- 1 import java.util.Scanner;
2 public class Exercise1_3 {
I (unit? 3 public static void main(String[] args) {
unit=2&lesson=18) 4 Scanner sc = new Scanner(System.in);
5 int n=sc.nextInt();
Lecture 05 : 6 int sum=0;
7 int result=1;
Java Applet 8 int i=0;
i

https://onlinecourses.nptel.ac.in/noc20_cs08/progassignment?name=103 1/3
02/07/2020 Programming in Java - Course

Programming 9 while(result<=n)
(unit? 10 {
11 if(i%2==0)
unit=2&lesson=19) 12 {
13 if(i%3==0)
Quiz : 14 {
Assignment 1 15 sum=sum+i;
16
(assessment? 17 }
name=93) 18 result=result+1;
19 }
Java Week 20 i=i+1;
21 }
1:Q2 22 System.out.println(sum);
(/noc20_cs08/progassignment?
23 }
name=102) 24 }

Java Week
1:Q3
(/noc20_cs08/progassignment?
name=103)

Java Week
1:Q4
(/noc20_cs08/progassignment?
name=105)

Java Week
1:Q5
(/noc20_cs08/progassignment?
name=106)

Feedback For
Week 1 (unit?
unit=2&lesson=112)

Week 2 :

Week 3 :

Week 4 :

Week 5 :

Week 6 :

Week 7 :

Week 8 :

Week 9 :

Week 10 :

Week 11 :

Week 12 :

DOWNLOAD
VIDEOS

https://onlinecourses.nptel.ac.in/noc20_cs08/progassignment?name=103 2/3
02/07/2020 Programming in Java - Course

Assignment
Solution

Books

Live Interactive
Session

https://onlinecourses.nptel.ac.in/noc20_cs08/progassignment?name=103 3/3

You might also like