Senin, 08 Desember 2025

ex1202.c highscore[4] array

/* ex1202.c */
#include <stdio.h>

int main()
{
    int highscore[4]; //array
    int x;

    for(x=0;x<4;x++)
    {
        printf("Your #%d score: ",x+1);
        scanf("%d",&highscore[x]);
    }
    puts("");
    puts("Here are your high scores");
    for(x=0;x<4;x++)
        printf("#%d %d\n",x+1,highscore[x]);
    return(0);
}

output:
 
Your #1 score: 10
Your #2 score: 20
Your #3 score: 50
Your #4 score: 80

Here are your high scores
#1 10
#2 20
#3 50
#4 80

Process returned 0 (0x0)   execution time : 6.072 s
Press any key to continue.

Tidak ada komentar:

Posting Komentar