0% found this document useful (0 votes)
106 views3 pages

Noc20-Cs06 Week 06 Assignment 02

This document provides instructions for a programming assignment in C to find the largest element in an integer array. Students are asked to write a C program that takes in an array size and elements as input, iterates through the array to find the largest element, and prints it out in the given printf statement. Sample test cases and inputs are provided. A deadline of March 12, 2020 is given for submitting the assignment. The document also provides a sample solution code for finding the largest element in an array.

Uploaded by

Suhas Hatti
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
106 views3 pages

Noc20-Cs06 Week 06 Assignment 02

This document provides instructions for a programming assignment in C to find the largest element in an integer array. Students are asked to write a C program that takes in an array size and elements as input, iterates through the array to find the largest element, and prints it out in the given printf statement. Sample test cases and inputs are provided. A deadline of March 12, 2020 is given for submitting the assignment. The document also provides a sample solution code for finding the largest element in an array.

Uploaded by

Suhas Hatti
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

03/07/2020 Problem solving through Programming In C - Course

(https://swayam.gov.in) (https://swayam.gov.in/nc_details/NPTEL)

[email protected]

NPTEL (https://swayam.gov.in/explorer?ncCode=NPTEL) » Problem solving through Programming In C

(course)

Announcements (announcements)

About the Course (https://swayam.gov.in/nd1_noc20_cs06/preview) Ask a Question (forum)

Progress (student/home) Mentor (student/mentor)

Week-06 Program-01
Course Due on 2020-03-12, 23:59 IST
outline
Write a C Program to find Largest Element of an Integer Array.
Here the number of elements in the array ‘n’ and the elements of the array is read from
How does an the test data.
NPTEL online Use the printf statement given below to print the largest element.
course work? printf("Largest element = %d", largest);
Week 0 Sample Test Cases
Input Output
Week 1
4
-400
Week 2
Test Case 1 -800 Largest element = -50
-700
Week 3
-50

Week 4
7
60
Week 5
70
200
Week 6 Test Case 2 Largest element = 200
12
Lecture 26: 40
Introduction to -90
Arrays (unit? 60
unit=7&lesson=40)

Lecture 27:
Arrays (Contd.)
(unit?
unit=7&lesson=41)

https://onlinecourses.nptel.ac.in/noc20_cs06/progassignment?name=125 1/3
03/07/2020 Problem solving through Programming In C - Course

Lecture 28:
Arrays (Contd.)
5
(unit? 10
unit=7&lesson=42) 50
Test Case 3 Largest element = 50
40
Lecture 29:
30
Program using
20
Arrays (unit?
unit=7&lesson=43)
7
Lecture 30:
100
Array Problem
50
(unit?
unit=7&lesson=44) 60
Test Case 4 Largest element = 100
70
Quiz : 90
Assignment 6
30
(assessment?
40
name=124)

Week-06
Program-01 The due date for submitting this assignment has passed.
As per our records you have not submitted this assignment.
(/noc20_cs06/progassignment?
name=125) Sample solutions (Provided by instructor)
1 #include <stdio.h>
Week-06 2
Program-02 3 int main()
4 {
(/noc20_cs06/progassignment?
5 int i, n, largest;
name=126) 6 int arr[100];
7
Week-06 8 scanf("%d", &n); /*Accepts total number of elements from the test d
Program-03 9
10 for(i = 0; i < n; ++i)
(/noc20_cs06/progassignment?
11 {
name=127) 12 scanf("%d", &arr[i]); /* Accepts the array element from test dat
13 }
Week-06 14
Program-04 15 largest = arr[0];
16 for(i = 1; i < n; ++i)
(/noc20_cs06/progassignment?
17 {
name=128) 18 if(largest < arr[i])
19 largest = arr[i];
Week-06 20 }
21 printf("Largest element = %d", largest);
Program-05 22
23
(/noc20_cs06/progassignment? return 0;
name=129) 24 }
25
Feedback For
Week 6 (unit?
unit=7&lesson=139)

Week 7

Week 8

Week 9

Week 10

Week 11

Week 12

https://onlinecourses.nptel.ac.in/noc20_cs06/progassignment?name=125 2/3
03/07/2020 Problem solving through Programming In C - Course

DOWNLOAD
VIDEOS

Assignment
Solution

https://onlinecourses.nptel.ac.in/noc20_cs06/progassignment?name=125 3/3

You might also like