MNNIT CC 2021-22 Classes

C Class 6

.. Previous Page

Class recording: Here

PPT: Part 1 and Part 2

February 12th, 2022

C language logo

[Scroll to the bottom of this page to discuss stuff].

Tasks

Functions

  1. Write a program (WAP) to accept two numbers in input and display all numbers from the first number to the second number using a function that accepts the two numbers as arguments.
  2. WAP to accept a number from the user and display all prime numbers between 1 and that number using a for loop and function that accepts a number as an argument and returns alphabet ā€˜Pā€™ if it is a prime number and ā€˜Nā€™ if it is not a prime number.
  3. WAP to accept a number from the user and display the multiplication tables of all numbers from 1 to that number using a function that accepts a number as an argument and prints the multiplication table of that number.
  4. WAP to input two numbers from the user and calculate nCr using a function that accepts an integer as an argument and returns the factorial of that number.

Header file

  1. Write the 3rd program above by creating a header file utility.h containing the required table printing function.

Variable scope


Reading

  1. Read about extern keyword. You can use this.
  2. Read about recursion in C, which will help in easy understanding of the next class. You can use this.