Home

Learn Programming & Prepare for NPTEL Exams... Swayam Solver is your one-stop destination for NPTEL exam preparation.

Introduction To Programming In C | Week 1 : Assignment 1 | Answers | Jan-2022 | NPTEL | Swayam

 Introduction To Programming In C



Week 1: Assignment 1 - Question 1

Due on 2022-03-02, 23:59 IST
You will be given 3 integers as input. The inputs may or may not be
 different from each other. 

You have to output 1 if sum of first two inputs is greater than the third input
and 0 otherwise

Input
-------------------------------------
Three integers separated by space.

Output
----------------------------------
1 if sum of first two inputs is greater than third input
0 otherwise
Your last recorded submission was on 2022-02-24, 11:28 IST
Select the Language for this assignment. 
1
#include<stdio.h>
void main()
{
    int a ,b, c;
  
    scanf("%d %d %d",&a, &b, &c);
  
    printf("%d",a+b>c);
}
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.
   

 
 
Public Test CasesInputExpected OutputActual OutputStatus
Test Case 1
1 2 3
0
0
Passed
Test Case 2
11 1 2
1
1
Passed




Private Test cases used for EvaluationStatus
Test Case 1
Passed
Test Case 2
Passed
Test Case 3
Passed
Test Case 4
Passed
Test Case 5
Passed






Week 1: Assignment 1 - Question 2

Due on 2022-03-02, 23:59 IST
You are given two integers, say M and N.
You have to output 1, if remainder is 1 when N divides M 
otherwise output 0

Input
----------------------------
Two integers, say M and N.

Output
---------------------------------------------------
You have to output 1 if remainder is 1 when M/N.
You have to output 0 , otherwise.
Your last recorded submission was on 2022-02-24, 11:30 IST
Select the Language for this assignment. 
1
#include<stdio.h>
void main()
{
    int M ,N;
  
    scanf("%d %d",&M, &N);
  
    printf("%d",M%N==1);
}
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.
   

 
 
Public Test CasesInputExpected OutputActual OutputStatus
Test Case 1
16 4
0
0
Passed
Test Case 2
4 3
1
1
Passed

Private Test cases used for EvaluationStatus
Test Case 1
Passed
Test Case 2
Passed
Test Case 3
Passed
Test Case 4
Passed
Test Case 5
Passed





Week 1: Assignment 1 - Question 3

Due on 2022-03-02, 23:59 IST
Input : Triplet of three numbers (a,b,c)
Output : 1 if they are either in strictly increasing (a>b>c) or decreasing (a<b<c) order
              0, otherwise.
Your last recorded submission was on 2022-02-24, 11:32 IST
Select the Language for this assignment. 
1
#include<stdio.h>
void main()
{
    int a ,b, c, output = 0;
    scanf("%d %d %d",&a, &b, &c);
  
    if(b<a && c<b)
      output=1;
  
    else if (b>a && c>b)
      output=1;
      
    printf("%d",output);
}
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.
   

 
 
Public Test CasesInputExpected OutputActual OutputStatus
Test Case 1
4 3 2
1
1
Passed
Test Case 2
1 2 1
0
0
Passed



Private Test cases used for EvaluationStatus
Test Case 1
Passed
Test Case 2
Passed
Test Case 3
Passed
Test Case 4
Passed
Test Case 5
Passed



Watch the video to see the program in motion.


Please subscribe to our YouTube Channel :  Swayam Solver

This will help the creator to continue making quality content...

Have a great day !

No comments:

Post a Comment

Keep your comments reader friendly. Be civil and respectful. No self-promotion or spam. Stick to the topic. Questions welcome.