Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- struct crickerters
- {
- char name[20];
- int matches;
- long int score;
- }c[5];
- int main()
- {
- int i;
- for (i=0;i<5;i++)
- {
- int a;
- long int b;
- printf("Enter the Name: ");
- scanf("%s",c[i].name);
- printf("Enter the no. of matches played: ");
- scanf("%d",&a);
- c[i].matches = a;
- printf("Enter the total runs scored: ");
- scanf("%ld",&b);
- c[i].score = b;
- }
- for(i=0;i<5; i++)
- {
- printf("\n\n%s\t\t%d\t%ld\n",c[i].name,c[i].matches,c[i].score);
- }
- }
- //Output
- //Enter the Name: Sachin
- //Enter the no. of matches played: 100
- //Enter the total runs scored: 10000
- //Enter the Name: Gayle
- //Enter the no. of matches played: 50
- //Enter the total runs scored: 1000
- //Enter the Name: Pointing
- //Enter the no. of matches played: 25
- //Enter the total runs scored: 900
- //Enter the Name: Akhtar
- //Enter the no. of matches played: 76
- //Enter the total runs scored: 340
- //Enter the Name: Sangakara
- //Enter the no. of matches played: 97
- //Enter the total runs scored: 9655
- //Sachin 100 10000
- //Gayle 50 1000
- //Pointing 25 900
- //Akhtar 76 340
- //Sangakara 97 9655
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement