Home

Swayam Solver

Learn Programming & Prepare for NPTEL Exams...

Find your course

Explore Courses

Latest Blog Posts

NPTEL Problem Solving Through Programming In C - Programming Assignment | July-2026



  Please scroll down for latest Programs   ðŸ‘‡ 


Code compiled and tested successfully!



Problem Solving through Programming in C

NPTEL


Week-03: Practice Program-01

Due date on 2026-08-13, 23:59 IST

Your last recorded submission was on 2026-08-10, 17:10 IST.

Q.

Write a C Program to calculates the area (floating point number with two decimal places) of a Circle given it’s radius (integer value). The value of Pi is 3.14.

[Marks for Week 3 Programming assignments will not be evaluated finally. This is for users to get familiar with programming in google course builder platform]


Complete Program

C
#include <stdio.h>
#define PI 3.14

void main()
{
    int radius;
    float area;

    scanf("%d", &radius);

    area = PI * radius * radius;

    printf("Area of a circle = %5.2f", area);
}

Code Snippet to Paste in the Editor

To complete the middle portion between scanf("%d", &radius); and printf(...):

C
area = PI * radius * radius;
// copy until this point




You may submit any number of times before the due date. The final submission will be considered for grading.

This assignment has Public Test cases. Please click on "Compile & Run" button to see the status of Public test cases. Assignment will be evaluated only after submitting using Submit button below. If you only save as or compile and run the Program, your assignment will not be graded and you will not see your score after the deadline.

Evaluation Results

CompilationSuccessful|Public Test Cases: 2/2 Passed

Note: These tests may not be considered while scoring.

Public Test Cases

Test Case
Input
Expected Output
Output
Status
Test Case 1

7

Area of a circle = 153.86
Area of a circle = 153.86
-
Test Case 2

50

Area of a circle = 7850.00
Area of a circle = 7850.00
-


Week-03: Practice Program-02

Due date on 2026-08-13, 23:59 IST

Your last recorded submission was on 2026-08-12, 14:46 IST.

Q.

Write a C program to check if a given Number is zero or Positive or Negative Using if...else statement.

[Week 3 programming assignments will not be considered for final evaluation]


Complete Program

C
#include <stdio.h>
int main()
{
    double number;
    scanf("%lf", &number);

    if (number == 0) {
        printf("The number is 0.");
    } else if (number < 0) {
        printf("Negative number.");
    } else {
        printf("Positive number.");
    }

    return 0;
}

Code Snippet to Paste in the Editor

If the template already includes the header and initial lines, add the following code after scanf("%lf", &number);:

C
    if (number == 0) {
        printf("The number is 0.");
    } else if (number < 0) {
        printf("Negative number.");
    } else {
        printf("Positive number.");
    }

    return 0;
}
// copy until this point


You may submit any number of times before the due date. The final submission will be considered for grading.

This assignment has Public Test cases. Please click on "Compile & Run" button to see the status of Public test cases. Assignment will be evaluated only after submitting using Submit button below. If you only save as or compile and run the Program, your assignment will not be graded and you will not see your score after the deadline.

Evaluation Results

CompilationSuccessful|Public Test Cases: 3/3 Passed

Note: These tests may not be considered while scoring.

Public Test Cases

Test Case
Input
Expected Output
Output
Status
Test Case 1

14.05

Positive number.
Positive number.
-
Test Case 2

0.45

Positive number.
Positive number.
-
Test Case 3

-50

Negative number.
Negative number.
-



Week-03: Practice Program-03

Due date on 2026-08-13, 23:59 IST

Your last recorded submission was on 2026-08-10, 18:53 IST.

Q.

Write a C program to check whether a given number (integer) is Even or Odd.

[Week 3 programming assignments will not be considered for final evaluation]

Complete Program

C
#include <stdio.h>
int main()
{
    int number;
    scanf("%d", &number);

    if (number % 2 == 0) {
        printf("%d is even.", number);
    } else {
        printf("%d is odd.", number);
    }

    return 0;
}

Code Snippet to Paste in the Editor

If entering only the remaining portion of code below scanf("%d", &number);

C
    if (number % 2 == 0) {
        printf("%d is even.", number);
    } else {
        printf("%d is odd.", number);
    }

    return 0;
}
// copy until this point


You may submit any number of times before the due date. The final submission will be considered for grading.

This assignment has Public Test cases. Please click on "Compile & Run" button to see the status of Public test cases. Assignment will be evaluated only after submitting using Submit button below. If you only save as or compile and run the Program, your assignment will not be graded and you will not see your score after the deadline.

Evaluation Results

CompilationSuccessful|Public Test Cases: 2/2 Passed

Note: These tests may not be considered while scoring.

Public Test Cases

Test Case
Input
Expected Output
Output
Status
Test Case 1

24

24 is even.
24 is even.
-
Test Case 2

-25

-25 is odd.
-25 is odd.
-


Week-03 Practice Program-04

Due date on 2026-08-13, 23:59 IST

Your last recorded submission was on 2026-08-10, 20:14 IST.

Q.

Write a C Program to find the Largest Number (integer) among Three Numbers (integers) using IF and Logical && operator.

[Week 3 programming assignments will not be considered for final evaluation]

Complete Program

C
#include <stdio.h>
int main()
{
    int n1, n2, n3;
    scanf("%d %d %d", &n1, &n2, &n3);

    if (n1 >= n2 && n1 >= n3) {
        printf("%d is the largest number.", n1);
    } else if (n2 >= n1 && n2 >= n3) {
        printf("%d is the largest number.", n2);
    } else {
        printf("%d is the largest number.", n3);
    }

    return 0;
}

Code Snippet to Paste in the Editor

If entering only the remaining portion of code below scanf("%d %d %d", &n1, &n2, &n3);:


C
    if (n1 >= n2 && n1 >= n3) {
        printf("%d is the largest number.", n1);
    } else if (n2 >= n1 && n2 >= n3) {
        printf("%d is the largest number.", n2);
    } else {
        printf("%d is the largest number.", n3);
    }

    return 0;
}
// copy until this point


You may submit any number of times before the due date. The final submission will be considered for grading.

This assignment has Public Test cases. Please click on "Compile & Run" button to see the status of Public test cases. Assignment will be evaluated only after submitting using Submit button below. If you only save as or compile and run the Program, your assignment will not be graded and you will not see your score after the deadline.

Evaluation Results

CompilationSuccessful|Public Test Cases: 2/2 Passed

Note: These tests may not be considered while scoring.

Public Test Cases

Test Case
Input
Expected Output
Output
Status
Test Case 1

45 34 67

67 is the largest number.
67 is the largest number.
-
Test Case 2

80 -5 3

80 is the largest number.
80 is the largest number.
-