Tuesday, April 23, 2024
HomeC ProgrammingProgram utilizing construction to retailer info of two workers (emp_id, title,wage) and...

Program utilizing construction to retailer info of two workers (emp_id, title,wage) and show the small print of the worker having wage larger


              

Code: 

#embrace <stdio.h>

struct worker

{

    char title[20];

    int  id;

    float wage;

};

int principal() {

struct worker e[10];

int i;

printf(“Particulars of Workern);

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

{

    printf(“Enter the worker Title:”);

    scanf(%s,e[i].title);

    printf(“Enter the worker Id:”);

    scanf(%d,&e[i].id);

    printf(“Enter the worker Wage:”);

    scanf(%f,&e[i].wage);

    

}

   

 printf(“Particulars of Worker whose wage is larger:”);

 if(e[0].wage<e[1].wage)

 {

     printf(nWorker title:%snWorker Id:%dnWorker Wage:%f,e[1].title,e[1].id,e[1].wage);

 }

 else 

 {

    printf(nWorker title:%snWorker Id:%dnWorker Wage:%f,e[0].title,e[0].id,e[0].wage);

 

    

}

return 0;

}

Pattern Enter and Output:

Particulars of Worker

Enter the worker Title:Pankaj

Enter the worker Id:12

Enter the worker Wage:84842

Enter the worker Title:Siddhiraj

Enter the worker Id:13

Enter the worker Wage:94949

Particulars of Worker whose wage is larger:

Worker title:Siddhiraj

Worker Id:13

Worker Wage:94949.000000

 

In case you any have doubt,suggestion relating to this put up or web site then be at liberty to share with us.

 

You probably have discovered one thing new from this put up then share this put up with your loved ones and
associates.

 

Blissful Studying :)😎   

 

Earlier
Subsequent

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments