Last active
March 7, 2017 10:36
-
-
Save sdrshnptl/72a82d90fabd392b264d4ab8d3091cd3 to your computer and use it in GitHub Desktop.
Shift array values to one position left for continuous input averaging.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
int marks[10]={0,1,2,3,4,5,6,7,8,9},i; | |
for(i=0; i<11; ++i) | |
{ | |
printf("%d ",marks[i]); | |
} | |
while(1) | |
{ | |
marks[0]=marks[1]; | |
marks[1]=marks[2]; | |
marks[3]=marks[4]; | |
marks[4]=marks[5]; | |
marks[5]=marks[6]; | |
marks[7]=marks[8]; | |
marks[8]=marks[9]; | |
marks[9]=marks[10]; | |
scanf("%d", &marks[10]); | |
for(i=0; i<11; ++i) | |
{ | |
printf("%d ",marks[i]); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment