0% found this document useful (0 votes)
53 views1 page

Lab 10

The document describes 3 tasks for a C programming lab assignment. Task 1 involves reading integers into an array, calculating the sum of positive numbers, sum of negative numbers, and average of all numbers. Task 2 populates an array with random numbers between 1-100, finds the largest and smallest elements, and displays the array and results. Task 3 cyclically permutes the elements of an array such that the first element becomes the last and each element shifts to the next index. The document instructs to write the programs, test them, and submit all source code in a single Word file.

Uploaded by

Munir Shah
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)
53 views1 page

Lab 10

The document describes 3 tasks for a C programming lab assignment. Task 1 involves reading integers into an array, calculating the sum of positive numbers, sum of negative numbers, and average of all numbers. Task 2 populates an array with random numbers between 1-100, finds the largest and smallest elements, and displays the array and results. Task 3 cyclically permutes the elements of an array such that the first element becomes the last and each element shifts to the next index. The document instructs to write the programs, test them, and submit all source code in a single Word file.

Uploaded by

Munir Shah
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/ 1

Lab 10

Task 1
Write a C program to read N integers from the keyboard (zero, +ve and ve) into an array and
find

The sum of negative numbers


The sum of positive numbers
Average of all numbers

Display all the output in a proper format.

Task 2
Write a program to populate an array of length 30 by randomly generated numbers between 1
and 100. Find the largest and smallest element in the array. Display the populated array, the
largest and the smallest element. Use const keyword to declare the size of the array.

Task 3
Write a C program to cyclically permute the elements of an array A. i.e. the content of A1
becomes that of A2, A2 contains A3 and so on and An contains A1. Sample Output is given
below.

Enter the value of n = 5


Enter the numbers
10
30
20
45
18
cyclically permuted numbers are given below
30
20
45
18
10

Deliverables

Copy all the programs in one word file and submit the source code on LMS.

You might also like