Header Ads Widget

Ticker

6/recent/ticker-posts

STRUCTURE PROGRAM ,ALGORITHM AND FLOWCHART




COMPUTER GAYN


Q. Write a program to

- Define structure Cricket_Team having element player_name, age, score_in_ODI.

- Declare and do Initialization the structure for 5 cricketers by taking input at run time

- Display the information of all cricketers.

 

Ans:-

 

#include<stdio.h>

struct cricketteam

{

    char name[10];

    int age;

    float score;

   

};

int main()

{

    int i,j;

    struct cricketteam b;

    for(i=0;i<=4;i++)

    {

   

    printf("enter the player name \n");

    scanf("%s",&b.name);

   

    printf("enter the player age \n");

    scanf("%d",&b.age);

   

    printf("enter score of player \n");

    scanf("%f",&b.score);

          }

         

          printf("team details...\n");

         

          for(j=0;j<=4;j++)

          {

   

   

   

    printf("player name=%s \n",b.name);

    printf("player age=%d \n",b.age);

    printf("player score=%f \n",b.score);

          }

         

    return 0;

   

}



ALGORITHM

Step 1:- start

Step 2:- initialize the structure

Step 3:- initialize the main function

Step 4:-process the player information

               printf("enter the player name \n");

    scanf("%s",&b.name);

   

    printf("enter the player age \n");

    scanf("%d",&b.age);

   

    printf("enter score of player \n");

    scanf("%f",&b.score);

step 5:-display the player information as an output

step 6:- stop

 

FLOWCHART

 


 

Post a Comment

0 Comments