NPTEL Problem solving through Programming In C Week 8 All Programming Assignment Solutions | Swayam 2022. With the growth of Information and Communication Technology, there is a need to develop large and complex software.
- Formulate simple algorithms for arithmetic and logical problems
- Translate the algorithms to programs (in C language)
- 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 LAYOUT
-
- Week 1 : Introduction to Problem Solving through programs, Flowcharts/Pseudo codes, the compilation process, Syntax and Semantic errors, Variables and Data Types
- Week 2 : Arithmetic expressions, Relational Operations, Logical expressions; Introduction to Conditional Branching
- Week 3 : Conditional Branching and Iterative Loops
- Week 4 : Arranging things : Arrays
- Week 5 : 2-D arrays, Character Arrays and Strings
- Week 6 : Basic Algorithms including Numerical Algorithms
- Week 7 : Functions and Parameter Passing by Value
- Week 8 : Passing Arrays to Functions, Call by Reference
- Week 9 : Recursion
- Week 10 : Structures and Pointers
- Week 11 : Self-Referential Structures and Introduction to Lists
- Week 12 : Advanced Topics
Course certificate
The course is free to enroll and learn from. But if you want a certificate, you have to register and write the proctored exam conducted by us in person at any of the designated exam centres.
The exam is optional for a fee of Rs 1000/- (Rupees one thousand only).
Date and Time of Exams: 23 April 2022 Morning session 9am to 12 noon; Afternoon Session 2pm to 5pm.
Registration url: Announcements will be made when the registration form is open for registrations.
The online registration form has to be filled and the certification exam fee needs to be paid. More details will be made available when the exam registration form is published. If there are any changes, it will be mentioned then.
Please check the form for more details on the cities where the exams will be held, the conditions you agree to when you fill the form etc.
CRITERIA TO GET A CERTIFICATE
This course will have an unproctored programming exam also apart from the Proctored exam, please check announcement section for date and time. The programming exam will have a weightage of 25% towards the Final score.
Final score = Assignment score + Unproctored programming exam score + Proctored Exam score
- Assignment score = 25% of average of best 8 assignments out of the total 12 assignments given in the course.
- ( All assignments in a particular week will be counted towards final scoring – quizzes and programming assignments).
- Unproctored programming exam score = 25% of the average scores obtained as part of Unproctored programming exam – out of 100
- Proctored Exam score =50% of the proctored certification exam score out of 100
YOU WILL BE ELIGIBLE FOR A CERTIFICATE ONLY IF ASSIGNMENT SCORE >=10/25 AND
UNPROCTORED PROGRAMMING EXAM SCORE >=10/25 AND PROCTORED EXAM SCORE >= 20/50.
If any one of the 3 criteria is not met, you will not be eligible for the certificate even if the Final score >= 40/100. Certificate will have your name, photograph and the score in the final exam with the breakup.It will have the logos of NPTEL and IIT Kharagpur.
Only the e-certificate will be made available. Hard copies will not be dispatched.
Once again, thanks for your interest in our online courses and certification. Happy learning.
Course Name : “Problem Solving through Programming In C”
Question : 1 Write a C Program to find HCF of 4 given numbers using recursive function
#include
int HCF(int, int); //You have to write this function which calculates the HCF.
int main()
{
int a, b, c, d, result;
scanf("%d %d %d %d", &a, &b, &c, &d); /* Takes 4 number as input from the test data */
result = HCF(HCF(a, b), HCF(c,d));
printf("The HCF is %d", result);
}
int HCF(int num1, int num2)
{
while(num1!=num2)
{
if(num1>num2)
return HCF (num1-num2, num2);
else
return HCF(num1, num2-num1);
}
return num1;
}
Course Name : “Problem Solving through Programming In C”
Question : 2 Write a C Program to find power of a given number using recursion. The number and the power to be calculated is taken from test case
#include
long power(int, int);
int main()
{
int pow, num;
long result;
scanf("%d", &num); //The number taken as input from test case data
scanf("%d", &pow); //The power is taken from the test case
result = power(num, pow);
printf("%d^%d is %ld", num, pow, result);
return 0;
}
long power(int n, int p)
{
if(p!=0)
return(n*power(n,p-1));
else
return 1;
}
Course Name : “Problem Solving through Programming In C”
Question : 3 Write a C Program to print Binary Equivalent of an Integer using Recursion
#include
int binary_conversion(int); //function to convert binary to decimal number
int main()
{
int num, bin; //num is the decimal number and bin is the binary equivalent for the number
scanf("%d", &num); //The decimal number is taken from the test case data
bin = binary_conversion(num); //binary number is stored in variable bin
printf("The binary equivalent of %d is %d\n", num, bin);
return 0;
}
int binary_conversion(int n)
{
if(n==0)
return 0;
else
return(n%2)+10*binary_conversion(n/2);
}
Course Name : “Problem Solving through Programming In C”
Question : 4 Write a C program to print a triangle of prime numbers upto given number of lines of the triangle. e.g If number of lines is 3 the triangle will be
#include
int prime(int num); //Function to find whether the number is prime or not.
int main()
{
int lines;
scanf("%d", &lines); //Number of lines of the triangle is taken from test data.
//use the printf statement as printf("%d\t", variable_name); to print the elements in a row
int i, j,n=2,p, count=1;
for(i=1;i<=lines;i++)
{
for(j=1;j<=i; j++)
{
while(!prime(n))
n=n+1;
printf("%d\t",n);
n=n+1;
}
printf("\n");
}
return 0;
}
int prime(int n)
{
int i;
for(i=2;i