Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void main(){
- //Init array
- int yeet[10];
- //Insert array
- for (int i = 0; i<10; i++){
- printf("insert a number\n");
- scanf("%i", &yeet[i]);
- }
- printf("\n====================================\n\n");
- //Print array
- for (int i = 0; i<10; i++){
- printf("%i ",yeet[i]);
- }
- //Print lowest in array
- int lowest = 999;
- int lindex = 0;
- int hindex = 0;
- for (int i = 0; i<10; i++){
- if (yeet[i] < lowest){
- lowest = yeet[i];
- lindex = i;
- }
- }
- printf("\nLowest: %i",lowest);
- //Print highest in array
- int highest = 0;
- for (int i = 0; i<10; i++){
- if (yeet[i] > highest){
- highest = yeet[i];
- hindex = i;
- }
- }
- printf("\nHighest: %i",highest);
- //Print positions
- printf("\nLow index: %i",lindex);
- printf("\nHigh index: %i",hindex);
- //Print mean
- float total;
- for (int i = 0; i<10; i++){
- total += yeet[i];
- }
- printf("\nMean: %f", (total/10));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement