Noc20-Cs06 Week 04 Assignment 05
Noc20-Cs06 Week 04 Assignment 05
(https://swayam.gov.in) (https://swayam.gov.in/nc_details/NPTEL)
reviewer4@nptel.iitm.ac.in
(course)
Announcements (announcements)
Week-04 Program-04
Course Due on 2020-02-27, 23:59 IST
outline
Write a C program to find power of a number using while loops. The
base number (>0) and exponent (>=0) is taken from the test cases.
How does an
NPTEL online
course work?
Sample Test Cases
Week 0 Input Output
6
Week 1 Test Case 1 The result is : 1
0
Week 2
4
Test Case 2 The result is : 65536
8
Week 3
5
Week 4 Test Case 3 The result is : 625
4
Lecture 16: IF-
ELSE 7
Statement Test Case 4 The result is : 343
3
(Contd.) (unit?
unit=5&lesson=30)
The due date for submitting this assignment has passed.
Lecture 17:
Switch
As per our records you have not submitted this assignment.
statement Sample solutions (Provided by instructor)
(unit? 1 #include <stdio.h>
unit=5&lesson=31) 2 int main()
3 {
4 int base, exponent;
Lecture 18: 5 long int result;
Switch 6 scanf("%d", &base); //The base value is taken from test case
https://onlinecourses.nptel.ac.in/noc20_cs06/progassignment?name=112 1/3
03/07/2020 Problem solving through Programming In C - Course
Statement 7 scanf("%d", &exponent); //The exponent value is taken from test case
(Contd.) and 8
9 if(exponent == 0)
Introduction to 10 result = 1;
Loops (unit? 11 else
unit=5&lesson=32) 12 {
13 result = 1;
14 while(exponent != 0)
Lecture 19: 15 {
Implementing 16 result = result * base;
Repetitions 17 --exponent;
18 }
(Loops) (unit? 19 }
unit=5&lesson=33) 20 printf("The result is : %ld\n", result);
21 return 0;
Lecture 20: 22 }
23
Implementation
of Loops with
for Statement
(Contd.) (unit?
unit=5&lesson=34)
Quiz :
Assignment 4
(assessment?
name=103)
Week-04
Program-01
(/noc20_cs06/progassignment?
name=109)
Week-04
Program-02
(/noc20_cs06/progassignment?
name=110)
Week-04
Program-03
(/noc20_cs06/progassignment?
name=111)
Week-04
Program-04
(/noc20_cs06/progassignment?
name=112)
Week-04
Program-05
(/noc20_cs06/progassignment?
name=113)
Feedback For
Week 4 (unit?
unit=5&lesson=115)
Week 5
Week 6
Week 7
Week 8
Week 9
https://onlinecourses.nptel.ac.in/noc20_cs06/progassignment?name=112 2/3
03/07/2020 Problem solving through Programming In C - Course
Week 10
Week 11
Week 12
DOWNLOAD
VIDEOS
Assignment
Solution
https://onlinecourses.nptel.ac.in/noc20_cs06/progassignment?name=112 3/3