Skip to main content

Week 10 Programming Assignment : Problem Solving Through Programming In C 2023

 

What is Problem Solving Through Programming In C?


Problem-solving through programming in C is a course of action where the students learn to apply the concepts of programming to solve problems that can be formulated as algorithms. The course primarily focuses on using the programming language C to develop algorithms and solve problems. The process involves identifying the problem, breaking it down into smaller sub-problems, and designing an algorithm to solve each of them. The algorithm is then translated into a program written in C, which can be executed to obtain the desired results.

The course typically covers the basic concepts of programming in C, such as variables, data types, operators, conditional statements, loops, functions, arrays, and pointers. Students learn how to use these concepts to solve problems such as sorting, searching, mathematical operations, string manipulation, and data structures. They also learn about algorithmic complexity and how to measure the efficiency of their programs.

Problem-solving through programming in C is a crucial skill for anyone who wants to pursue a career in computer science or related fields. It helps students develop their analytical and logical thinking skills, which are essential for solving complex problems. It also provides a foundation for learning other programming languages and concepts.

This approach can be used to solve a wide range of problems, from simple arithmetic calculations to complex algorithms and data structures. The key to success in problem-solving through programming in C is to have a strong understanding of the language, good coding practices, and the ability to think logically and creatively to solve problems.

Week-10 Program-01

Due on 2023-04-06, 23:59 IST

Solution :

do
    {
        if (fun(a)*fun(x) < 0)
            b=x;
        else
            a=x;
        bisection (&x1, a, b, &itr);
        if (((x1-x)<0 && -(x1-x)< allerr) || ((x1-x)>0 && (x1-x)< allerr))
        {
            printf("Root = %1.4f\n", x1);
            return 0;
        }
        x=x1;
    }
    while (itr < maxmitr);
    return 1;
}
float fun (float x)
{
    return (2*x*x*x - 3*x - 5);
}
void bisection (float *x, float a, float b, int *itr)
/* this function performs and prints the result of one iteration */
{
    *x=(a+b)/2;
    ++(*itr);
}


Week-10 Program-02

Due on 2023-04-06, 23:59 IST

Solution :

float h;
    for (itr=1; itr<=maxmitr; itr++)
    {
        h=f(x0)/df(x0);
        x1=x0-h;
        x0=x1;
    }
    printf("Root = %8.6f\n", x1);
    return 0;
}
float f(float x)
{
    return x*x*x - 2*x  - 3;
}
float df (float x)
{
    return 3*x*x-2;
}


Week-10 Problem-03

Due on 2023-04-06, 23:59 IST
Write a C program to sort a given 1D array using pointer in ascending order.

[N.B: Ignore the presentation error in your output].

Solution :

int j,t;
for (i=0; i<(n-1); i++) 
    {
        for (j=i+1; j<n; j++)
        {
            if (*(a+i)>*(a+j))
            {
                t=*(a+i);
                *(a+i)=*(a+j);
                *(a+j)=t;
            }
        }
    }


Week-10 Problem-04

Due on 2023-04-06, 23:59 IST
Write a C program to sort a 1D array using pointer by applying Bubble sort technique.

[N.B: Ignore the presentation error in your output].

Solution :

void sort(int *a, int n) {
    int i,j,temp;
    for(i=0;i<n-1;i++) {
        for(j=0;j<n-i-1;j++) {
            if(*(a+j)>*(a+j+1)) {
                temp=*(a+j);
                *(a+j)=*(a+j+1);
                *(a+j+1)=temp;
            }
        }
    }
}

CRITERIA TO GET A CERTIFICATE

Average assignment score = 25% of the average of the 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 THE AVERAGE ASSIGNMENT SCORE >=10/25 AND THE 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.

Problem-Solving Through Programming In CAnswers
Assignment 1Click Here
Assignment 2Click Here
Assignment 3Click Here
Assignment 4Click Here
Assignment 5Click Here
Assignment 6Click Here
Assignment 7Click Here
Assignment 8Click Here
Assignment 9Click Here
Assignment 10Click Here
Assignment 11NA
Assignment 12NA

Comments

Popular posts from this blog

Week 3 Programming Assignment : Programming in Modern C++ 2023

  What is Programming in Modern C++? This course introduces problem-solving and programming using the C++ programming language. The topics include: Basic programming notions. Control flow, variables, and assignments statements, conditional execution, looping, function calls including recursion. Arrays and structures. Elementary aspects of classes. Heap memory.  Program design. How human beings solve problems manually. Strategies for translating manual techniques to computer programs. Organizing large programs into units such as functions and classes. Introduction to assertions and invariants. Programming applications. Arithmetic on polynomials, and matrices. Root finding. Sorting and searching. Design of editors and simulators, including graphical editors. Elementary animation. A rudimentary graphics system will be discussed. Standard Library of C++. The string, vector, and map classes. W3_Programming_Qs-1 Due on 2023-02-16, 23:59 IST Consider the program below. Fill in the bl...

Week 11 Programming Assignment : Programming in JAVA 2023

  What is Programming in Java? Java is a popular object-oriented programming language that was first released in 1995. It is used for developing a wide range of applications, including desktop applications, mobile applications, web applications, and enterprise applications. Here are some key features and concepts of Java programming: Object-oriented programming: Java is an object-oriented language, which means that it focuses on the creation of objects that contain both data and methods that operate on that data. Platform independence: Java programs can run on any platform that supports a Java Virtual Machine (JVM), which makes it a popular choice for cross-platform development. Memory management: Java uses automatic memory management through a garbage collector, which helps to prevent memory leaks and makes it easier to write memory-safe code. Exception handling: Java has a built-in mechanism for handling runtime errors or exceptions, which helps to ensure that programs can re...

Week 4 Programming Assignment : The Joy of Computing using Python 2023

  What is The Joy of Computing using Python? Python is a popular programming language that is easy to learn and widely used for various applications such as web development, data science, and artificial intelligence. Learning Python can be a joyous experience as it allows you to create your own programs, automate tasks, and solve real-world problems. Here are some tips to help you experience the joy of computing using Python: Start with the basics: Before diving into advanced topics, it is essential to learn the basics of Python such as syntax, data types, and control structures. This will help you build a strong foundation and make it easier to learn more advanced topics. Practice coding: The more you practice coding, the better you will get at it. You can start by writing simple programs and gradually move on to more complex ones. There are also many online resources such as coding challenges and competitions that can help you improve your coding skills. Learn from others: There ...

Week 2 Programming Assignment : Programming in Modern C++ 2023

  What is Programming in Modern C++? This course introduces problem-solving and programming using the C++ programming language. The topics include: Basic programming notions. Control flow, variables, and assignments statements, conditional execution, looping, function calls including recursion. Arrays and structures. Elementary aspects of classes. Heap memory.  Program design. How human beings solve problems manually. Strategies for translating manual techniques to computer programs. Organizing large programs into units such as functions and classes. Introduction to assertions and invariants. Programming applications. Arithmetic on polynomials, and matrices. Root finding. Sorting and searching. Design of editors and simulators, including graphical editors. Elementary animation. A rudimentary graphics system will be discussed. Standard Library of C++. The string, vector, and map classes. W2_Programming_Qs-1 Due on 2023-02-09, 23:59 IST Consider the program below. • Fill in th...

Week 1 Programming Assignment : Programming in Modern C++ 2023

  What is Programming in Modern C++? This course introduces problem-solving and programming using the C++ programming language. The topics include: Basic programming notions. Control flow, variables, and assignments statements, conditional execution, looping, function calls including recursion. Arrays and structures. Elementary aspects of classes. Heap memory.  Program design. How human beings solve problems manually. Strategies for translating manual techniques to computer programs. Organizing large programs into units such as functions and classes. Introduction to assertions and invariants. Programming applications. Arithmetic on polynomials, and matrices. Root finding. Sorting and searching. Design of editors and simulators, including graphical editors. Elementary animation. A rudimentary graphics system will be discussed. Standard Library of C++. The string, vector, and map classes. W1_Programming_Qs_1 Due on 2023-02-09, 23:59 IST Consider the program below. • Fill in the ...

Week 2 Programming Assignment : Programming in JAVA 2023

  What is Programming in Java? Java is a popular object-oriented programming language that was first released in 1995. It is used for developing a wide range of applications, including desktop applications, mobile applications, web applications, and enterprise applications. Here are some key features and concepts of Java programming: Object-oriented programming: Java is an object-oriented language, which means that it focuses on the creation of objects that contain both data and methods that operate on that data. Platform independence: Java programs can run on any platform that supports a Java Virtual Machine (JVM), which makes it a popular choice for cross-platform development. Memory management: Java uses automatic memory management through a garbage collector, which helps to prevent memory leaks and makes it easier to write memory-safe code. Exception handling: Java has a built-in mechanism for handling runtime errors or exceptions, which helps to ensure that programs can re...

Week 9 Programming Assignment : Programming in JAVA 2023

  What is Programming in Java? Java is a popular object-oriented programming language that was first released in 1995. It is used for developing a wide range of applications, including desktop applications, mobile applications, web applications, and enterprise applications. Here are some key features and concepts of Java programming: Object-oriented programming: Java is an object-oriented language, which means that it focuses on the creation of objects that contain both data and methods that operate on that data. Platform independence: Java programs can run on any platform that supports a Java Virtual Machine (JVM), which makes it a popular choice for cross-platform development. Memory management: Java uses automatic memory management through a garbage collector, which helps to prevent memory leaks and makes it easier to write memory-safe code. Exception handling: Java has a built-in mechanism for handling runtime errors or exceptions, which helps to ensure that programs can re...