### Introduction to programming in C Week 3

Course Name: Introduction to programming in C

Question 1

#### Complete the function int find_factorial(int k) to find the factorial of the positive number k.The factorial of a positive integer k, denoted by k!, is the product of all positive integers less than or equal to k.k!=k×(k−1)×⋯×1.InputThe first line of input is a positive integer N.The next line contains N positive integers ki for i=1 to N.OutputFor each ki given as input, print factorial of ki.

Code:-

``Update Soon``

These are Introduction to programming in C Assignment 3 Answers

Question 2

Write a C function to find the kth occurrence of an odd integer in a sequence of non-negative integers, and then call your function from main.
Your function should be according to the following declaration:
int find_odd(int k);

Input
——–
You are given the input in two lines:
The first line contains a positive integer k.
In the second line, you will be given a sequence of numbers terminated with a -1.
You have to find the kth occurrence of an odd integer in the sequence.
Note:  The -1 is not part of the sequence.

Output
———-
If there are k odd numbers in the sequence, then output the kth occurrence of an odd number in the sequence, if present. If there are less than k odd numbers in the sequence, output -1.
Sample Input
——————
2
1 4 3 6 5 2 3 4 1 -1
Sample Output
——————–
3

Code:-

``Update Soon``

These are Introduction to programming in C Assignment 3 Answers

Question 3

The two moving average is the sequence of averages of the last 2 entries.
For the first number, no average is output.
For example, if the sequence of numbers is a1,a2,a3,a4,a5
The 2-moving average is (a1+a2)/2,(a2+a3)/2,(a3+a4)/2,(a4+a5)/2.

Code:-

``Update Soon``

These are Introduction to programming in C Assignment 3 Answers

More Nptel courses: https://progiez.com/nptel

* The material and content uploaded on this website are for general information and reference purposes only. Please do it by your own first. COPYING MATERIALS IS STRICTLY PROHIBITED.

These are Introduction to programming in C Assignment 3 Answers