Create a Ccode program not c that will perform the following
Create a C-code program (not c++) that will perform the following operations on an array containing grades by using appropriate functions. Use the array elements (as shown in the output) in the main program and call the respective functions. The program should print the array values before array change and array values after the array change.The functions shouldcalculate the standard deviation and returns the standard deviation.add the standard deviation (use the integer portion after rounding) to each of the original array elements. If the new value exceeds 100, the final value should be limited to 100.Sort the array using modified bubble sort.
Expected Output:
Exam scores: 80 82 90 95 90 87 92
Standard deviation: 4.9857
Adjusted exam scores: 85 87 95 100 95 92 97
Sorted exam scores: 85 87 92 95 95 97 100
| Exam scores: 80 82 90 95 90 87 92 Standard deviation: 4.9857 Adjusted exam scores: 85 87 95 100 95 92 97 Sorted exam scores: 85 87 92 95 95 97 100 | 
Solution
// code starts here
 #include <stdio.h>
 #include <math.h>
//method to swap two numbers
 void swap(float *b,float *c)
 {
 int x;
 x=*b;
 *b=*c;
 *c=x;
 }
 
 int main () {
float n[7] = {80,82,90,95,90,87,92}; /* n is an array of 10 integers */
 int i,j,flag;
 float sum = 0;
//loop to find the sum
 for (i = 0; i < 7; i++ ) {
 sum = sum+n[i];
 }
 float mean = sum/7;//finding mean
 float var1 = 0;
//loop to calculate variance
 for (i = 0; i < 7; i++ ) {
 var1 = var1+((n[i]-mean)*(n[i]-mean));
 }
 float varienceofn = var1/7;//finding varience
 float standdev = round(sqrt(varienceofn));//standard deviation
//adding standard deviation to all elements of array
 for (i = 0; i < 7; i++ ) {
 if((n[i]+standdev)>100.0) {n[i]=100.0;}
 else {n[i] = n[i]+standdev;}
 }
 for (i = 0; i < 7; i++ ) {
 printf(\"%d \",(int)n[i]);
 }
//loop for modified bubble sort
 for(i=0;i<7;i++)
 {
 flag=0;
 for(j=0;j<6-i;j++)
 {
 if(n[j]>n[j+1])
 {
 flag=1;
 swap(&n[j],&n[j+1]);
 }
 }
 if(flag==0)
 break;
 }
 printf(\"\ \");
//printing the values of modified array
 for (i = 0; i < 7; i++ ) {
 printf(\"%d \",(int)n[i]);
 }
 return 0;
 }
Output:


