Problem Solving Through Programming in C Week 4: Programming Assignments Jan-Jun 2022

 NPTEL PROGRAMMING ASSIGNMENTS


Problem Solving Through Programming in C

Week-04: Program-01

Due Date of Submission 2022-02-24, 23:59 IST
Write a C Program to Find the Smallest Number among Three Numbers (integer values) using Nested IF-Else statement.


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


 

 




Week-04: Program-02

Due Date of Submission 2022-02-24, 23:59 IST
Write a C program to find power of a number using while loops. The base number (>0) and exponent (>=0) is taken from the test cases.


#include <stdio.h>
int main()
{
int base, exponent;
long int result;
scanf("%d", &base); 
scanf("%d", &exponent);


 

 




Week-04 Program-03

Due Date of Submission 2022-02-24, 23:59 IST
Write a C program to calculate the Sum of First and the Last Digit of a given Number. For example if the number is 1234 the result is 1+4 = 5.


#include <stdio.h>
int main()
{
int N, First_digit, Last_digit;
scanf("%d", &N);


 

 



Week-04 Program-04

Due Date of Submission 2022-02-24, 23:59 IST
Write a program to find the factorial of a given number using while loop.


#include<stdio.h>
void main()
{
    int n;
    long int fact;  /* n is the number whose factorial we have to find and fact is the factorial */
    scanf("%d",&n);



 

 


Post a Comment (0)
Previous Post Next Post