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 Problem-01
Course Due on 2020-03-05, 23:59 IST
outline
Write a C program to check whether a given number (N) is a perfect number
or not?
How does an
NPTEL online [Perfect Number - A perfect number is a positive integer number which is equals
course work? to the sum of its proper positive divisors. For example 6 is a perfect number
because its proper divisors are 1, 2, 3 and it’s sum is equals to 6.]
Week 0
Sample Test Cases
Week 1 Input Output
Test Case 1 8000 8000 is not a perfect number.
Week 2
Test Case 2 8128 8128 is a perfect number.
Week 3
Week 4 Test Case 3 6 6 is a perfect number.
Week 5 Test Case 4 87 87 is not a perfect number.
Lecture 21: For
Statement The due date for submitting this assignment has passed.
(Contd.) (unit? As per our records you have not submitted this assignment.
unit=6&lesson=35) Sample solutions (Provided by instructor)
1 #include <stdio.h>
Lecture 22: 2 int main()
Example of If- 3 {
Else (unit? 4 int N;
5 scanf("%d",&N); /* An integer number taken as input from test cases
unit=6&lesson=36) 6
7 /*Complete the program by writing the rest of the code in the space pro
Lecture 23 : 8
Example of 9 Please copy and paste the printf statement given below wherever require
https://onlinecourses.nptel.ac.in/noc20_cs06/progassignment?name=118 1/3
03/07/2020 Problem solving through Programming In C - Course
Loops (unit? 10 printf("\n%d is a perfect number.",N);
unit=6&lesson=37) 11 printf("\n%d is not a perfect number.",N);
12 */
13
Lecture 24 : 14 int i, sum=0;
Example of 15 for(i=1; i<N;i++)
Loops (Contd.) 16 {
17 if(N%i==0)
(unit? 18 sum+=i;
unit=6&lesson=38) 19 }
20
Lecture 25 : 21 if(sum==N)
22 printf("\n%d is a perfect number.",N);
Example of 23 else
Loops 24 printf("\n%d is not a perfect number.",N);
(Contd.), Use 25 }
26
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=118 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=118 3/3