NPTEL Introduction to programming in c Assignment 4 solutions
Question 1:
Programming Assignment_4 Question 1
Due on 2018-09-27, 23:59 IST
Given two arrays of integers output the smallest number in the
first array not present in the second one.
Input Specification:
The first line contains the size N1 of the first array.
Next line give the contents of the first array.
Next line contains the size N2 of the second array.
Next line give the contents of the second array.
Output Format:
Output must be a single number which is the smallest number occurring
in the first array that does not occur in the second. In case there is
no such number, output NO.
Variable Constraints:
The sizes of the arrays are smaller than 20.
Each array entry is an integer which fits an int data type.
Example:
Input:
3
2 3 4
4
1 3 5 7
Output: 2
Input
1
1
2
1 2
Output: NO
Given two arrays of integers output the smallest number in the first array not present in the second one. Input Specification: The first line contains the size N1 of the first array. Next line give the contents of the first array. Next line contains the size N2 of the second array. Next line give the contents of the second array. Output Format: Output must be a single number which is the smallest number occurring in the first array that does not occur in the second. In case there is no such number, output NO. Variable Constraints: The sizes of the arrays are smaller than 20. Each array entry is an integer which fits an int data type. Example: Input: 3 2 3 4 4 1 3 5 7 Output: 2 Input 1 1 2 1 2 Output: NO
Programming Assignment 4 Question 2
Due on 2018-09-27, 11:59 ISTFind the number of distinct numbers in a given sequence. The sequence need not be sorted.Input The input consists of two lines. The first line consists of a positive number N. N is at most 1000. The second line consists of N numbers separated by spaces. OutputThe output should be the number of distinct elements in the sequence. Sample Input4 1 2 3 1Sample Output 3
Input Output Test Case 1 4 1 2 3 1 3Test Case 2 5 -1 -2 -3 -1 -2 3Test Case 3 1 1 1Test Case 4 100 1 2 3 4 5 6 7 8 9 10 19 18 17 16 15 14 13 12 11 1 2 3 4 5 6 7 8 9 10 19 18 17 16 15 14 13 12 11 1 2 3 4 5 6 7 8 9 10 19 18 17 16 15 14 13 12 11 1 2 3 4 5 6 7 8 9 10 19 18 17 16 15 14 13 12 11 1 2 3 4 5 6 7 8 9 10 19 18 17 16 15 14 13 12 11 1 2 3 4 5 19Due Date Exceeded.
As per our records you have not submitted this assignment.Sample solutions (Provided by instructor) Select the Language .
Programming Assignment_4 Question 3
Due on 2018-09-27, 23:59 IST
Write a program that replaces the occurence of a given character (say c) in a primary string (say PS) with another string (say s). Input: The first line contains the primary string (PS) The next line contains a character (c) The next line contains a string (s) Output: Print the string PS with every occurence of c replaced by s. NOTE: - There are no whitespaces in PS or s. - Maximum length of PS is 100. - Maximum length of s is 10.
Looking for a quick and reliable way to handle your academic workload? Our Do My Assignment service is here to help! With expert assistance across various subjects, we provide high-quality, personalized solutions to ensure you meet deadlines and achieve top grades. Let us simplify your assignments and make academic success more attainable today!
ReplyDelete