Problem Solving Through Programming In C | NPTEL 2023 | Week 5 Assignment Solutions
ABOUT THE COURSE :
This course is aimed at enabling the students to
- Translate the algorithms to programs (in C language)
- Formulate simple algorithms for arithmetic and logical problems
- Test and execute the programs and correct syntax and logical errors
- Implement conditional branching, iteration and recursion
- Decompose a problem into functions and synthesize a complete program using divide and conquer approach
- Use arrays, pointers and structures to formulate algorithms and programs
- Apply programming to solve matrix addition and multiplication problems and searching and sorting problems
- Apply programming to solve simple numerical method problems, namely rot finding of function, differentiation of function and simple integration
Course Status : Upcoming
Course Type : Elective
Duration : 12 weeks
Start Date : 23 Jan
2023
End Date : 14 Apr 2023
Exam Date : 29 Apr 2023 IST
Enrollment Ends : 06 Feb 2023
CRITERIA TO GET A CERTIFICATE :
Average assignment score = 25% of average of best 8 assignments out of the total 12 assignments given in the course.
Exam score = 75% of the proctored certification exam score out of 100
Final score = Average assignment score + Exam score
YOU WILL BE ELIGIBLE FOR A CERTIFICATE ONLY IF AVERAGE ASSIGNMENT SCORE >=10/25 AND EXAM SCORE >= 30/75. If one of the 2 criteria is not met, you will not get the certificate even if the Final score >= 40/100.
NOTE: Please note that there will not be an unproctored programming exam for this course this term.
Week 5 Programming Assignment 1 :-
Week 5 Programming Assignment 1
int temp, no_of_digit;
no_of_digit=0;
temp=N;
while(temp>0)
{
no_of_digit+=1;
temp/=10;
}
printf("The number %d contains %d digits.",N,no_of_digit);
}
Week 5 Programming Assignment 2 :-
Week 5 Programming Assignment 2
int t2, flag;
t2=N;
flag=0;
while(t2!=1)
{
if(t2%2!=0){
flag=1;
break;
}
t2/=2;
}
if(flag==0)
printf("%d is a number that can be expressed as power of 2.",N);
else
printf("%d cannot be expressed as power of 2.",N);
}
Week 5 Programming Assignment 3 :-
Week 5 Programming Assignment 3
for(int z=1;z<=n;z=z+2)
{
sum+=z*z;
}
printf("Sum=%d",sum);
return 0;
}
Week 5 Programming Assignment 4 :-
Week 5 Programming Assignment 4
int i3,j;
for(i3=N; i3>0; i3--)
{
for(j=0;j < i3;j++)
{
printf("*");
}
printf("\n");
}
} 
Follow Us