# Introduction To Programming in C | NPTEL | Week 1 Assignment Solutions

This post will help you with the solutions of Introduction To Programming in C NPTEL 2022 Week 1 Assignment.

This is a course in programming in C. No prior programming experience is assumed; however, mathematical maturity at the level of a second year science or engineering undergraduate is assumed.We emphasize solving problems using the language, and introduce standard programming techniques like alternation, iteration and recursion. We will briefly glimpse the basics of software engineering practices like modularization, commenting, and naming conventions which help in collaborating and programming in teams. Given a problem, we pay attention to the following questions:

1. What is an algorithmic solution to the problem?
2. How do we translate the algorithm into C code?
3. How efficient is the code?
4. How maintainable is the code?

### Introduction To Programming in C NPTEL 2022 Week 1 Assignment Solutions

#### Week 1: Question 1

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

``````#include<stdio.h>

void main() {
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
if((a + b) > c)
printf("1");
else
printf("0");
}``````

#### Week 1: Question 2

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.

``````#include<stdio.h>

void main() {
int M, N;
scanf("%d %d", &M, &N);
if(M%N == 1)
printf("1");
else
printf("0");
}``````

#### Week 1: Question 3

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.

``````#include<stdio.h>

void main() {
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
if((a>b && b>c) || (a<b && b<c))
printf("1");
else
printf("0");
}``````

<< Prev- Introduction To Programming in C Week 0 Assignment Solutions

>> Next- Introduction To Programming in C Week 2 Assignment Solutions

`DISCLAIMER: Use these answers only for the reference purpose. Quizermania doesn't claim these answers to be 100% correct. So, make sure you submit your assignments on the basis of your knowledge.`

NPTEL answers: Problem solving through programming in C

Programming in Java NPTEL week 1 quiz answers

Nptel – Deep Learning assignment solutions

For discussion about any question, join the below comment section. And get the solution of your query. Also, try to share your thoughts about the topics covered in this particular quiz.