You are on page 1of 3

03/07/2020 Problem solving through Programming In C - 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) » Problem solving through Programming In C

(course)

Announcements (announcements)

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

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

Week-05 Program-04
Course Due on 2020-03-05, 23:59 IST
outline
Write a C program to find sum of following series where the value of N is taken
as input
How does an 1+ 1/2 + 1/3 + 1/4 + 1/5 + .. 1/N
NPTEL online
course work?
Sample Test Cases
Input Output
Week 0
Test Case 1 100 Sum of the series is: 5.19
Week 1
Test Case 2 20 Sum of the series is: 3.60
Week 2
Test Case 3 6 Sum of the series is: 2.45
Week 3

Test Case 4 50 Sum of the series is: 4.50


Week 4

Week 5 The due date for submitting this assignment has passed.
As per our records you have not submitted this assignment.
Lecture 21: For Sample solutions (Provided by instructor)
Statement
1 #include<stdio.h>
(Contd.) (unit? 2 int main()
unit=6&lesson=35) 3 {
4 int N;
Lecture 22: 5 float sum = 0.0;
6 scanf("%d",&N); /*Read the value of N from test cases provided*/
Example of If- 7
Else (unit? 8 /* Complete the program. Please use the printf statement given below:
unit=6&lesson=36) 9
10 printf("Sum of the series is: %.2f",sum);
11
Lecture 23 : 12 */
Example of 13 int i;

https://onlinecourses.nptel.ac.in/noc20_cs06/progassignment?name=121 1/3
03/07/2020 Problem solving through Programming In C - Course

Loops (unit? 14 for(i=1;i<=N;i++)


unit=6&lesson=37) 15 sum = sum + ((float)1/(float)i);
16 printf("Sum of the series is: %.2f",sum);
17 }
Lecture 24 : 18
Example of
Loops (Contd.)
(unit?
unit=6&lesson=38)

Lecture 25 :
Example of
Loops
(Contd.), Use
of FOR Loops
(unit?
unit=6&lesson=39)

Quiz :
Assignment 5
(assessment?
name=104)

Week-05
Problem-01
(/noc20_cs06/progassignment?
name=118)

Week-05
Problem-02
(/noc20_cs06/progassignment?
name=119)

Week-05
Problem-03
(/noc20_cs06/progassignment?
name=120)

Week-05
Program-04
(/noc20_cs06/progassignment?
name=121)

Week-05
Program-05
(/noc20_cs06/progassignment?
name=122)

Feedback For
Week 5 (unit?
unit=6&lesson=130)

Week 6

Week 7

Week 8

Week 9

Week 10

https://onlinecourses.nptel.ac.in/noc20_cs06/progassignment?name=121 2/3
03/07/2020 Problem solving through Programming In C - Course

Week 11

Week 12

DOWNLOAD
VIDEOS

Assignment
Solution

https://onlinecourses.nptel.ac.in/noc20_cs06/progassignment?name=121 3/3

You might also like