Nptel Assignment Questions

Click Here to go to NPTEL page

Programs:

  1. Write a c program to take three numbers as input and find whether the three numbers form a Pythagorean triple or not. If the sum of squares of two numbers is equal to the square of the third then it is known as Pythagorean triple. For example, 3, 5 and 4 form a Pythagorean triple, since 3*3 + 4*4 = 25 = 5*5
  2. Write a c program to take an input N, which is a positive integer less than or equal to 40. Write a program to find the sums of fourth powers of the first N numbers.
  3. Write a c program to take an input NxN matrix. You have to determine whether the matrix is a triangular matrix or not.
  4. You are given a sequence of integers as input, terminated by a -1. (That is, the input integers may be positive, negative or 0. A -1 in the input signals the end of the input.) -1 is not considered as part of the input. Find the second largest number in the input. You may not use arrays.
  5. You are given a sequence of numbers, ending with a -1. You can assume that are at least two numbers before the ending -1. You have to output the sequence of sums of adjacent pairs of numbers. You may not use arrays.
  6. Write a c program to take N as input and print the following inverted triangle: where N is the height of the inverted triangle.
    12345678901234
    2345678901234
    345678901234
    45678901234
    5678901234
    678901234
    78901234
    8901234
    901234
    01234
    1234
    234
    34
    4
  7. Write a function called divide that takes two non-negative integers : a and b and returns the quotient of a divided by b, if b is a factor of a, else it returns -1.
  8. Write a C program that calculates the number of ways to choose k objects from n distinct objects. 'k' and 'n' both are integers.
  9. You are given a sequence of n-1 distinct positive integers, all of which are less than or equal to a integer ‘n’. You have to find the integer that is missing from the range [1,2,...,n]. You may not use arrays.
  10. Write a C program that calculates the least common multiple (LCM) of 'n' numbers.
  11. Write a C program that given an integer ‘n’, prints the number of integers that are less than or equal to ‘n’ and co-prime to ‘n’
    Note:Two integers a and b are said to be relatively prime or co-prime if the only positive integer that evenly divides both of them is 1. That is, the only common positive factor of the two numbers is 1. This is equivalent to their greatest common divisor being 1.
  12. Write a program that takes as input two long integers n and m where 0=n=m. The program prints an integer k, where k is the count of factorial numbers in the closed interval [n,m].
    Note: 1. The interval is closed, i.e., n and m are included in count if they are factorial numbers.
              2. Ignore Presentation Errors for this problem.
  13. Write a c program to take N as input and check if it is a Palindrome.
  14. Happy Coding......