Skip to main content

C Program to input the name of the branches, total sales of the company into an array of structures

  Program to input  the name of the branches, total sales of the company into an array of structures, display the branch name and sales of branch who had highest sales.


 

#include<stdio.h>

struct branch

{

char name[25];

long sale;

};

main()

{

struct branch b[100];

int n,i,m;

long max;

clrscr();

printf("\nEnter the no. of Branches");

scanf("%d",&n);

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

{

printf("\nEnter the details of branch %d",i+1);

printf("\nEnter the branch name\n");

scanf("%s",b[i].name);

printf("\nEnter the total sales:\n");

scanf("%ld",&b[i].sale);

}

max=b[0].sale;

m=0;

for(i=1;i<n;i++)

{

if(b[i].sale>max)

{

max=b[i].sale;

m=i;

}

printf("\nBranch with highest Sales:");

printf("\nName:%s",b[i].name);

printf("\nSales: %d\n",b[i].sale);

      }

getch();


}

Comments

Popular posts from this blog

HC Mac OS X Live DVD Highly Compressed 1.9 MB Free Download

Size : 1.9 MB HC Mac OS X Live DVD  Free Download Free Download HC Mac OS X Live DVD Free Download

Windows 7 For Android [apk] | Full Version | Free Download

Windows 7 For Android [apk] | Full Version | Free Download INFO Please Note: If you have a Motorola Phone with Motoblur please download "Moto Home Fix" by Nightshade Labs to choose the home application. It's finally here! Windows 7 for Android! You can now emulate Windows 7 on your Android device. This home application can replace the default home application (if desired) and allows you to access anything on your phone through Windows 7 for Android. No other application required! Unlike most home or theme applications that require Launcher Pro or similar apps. This means more memory for you and a quicker interface. This application includes many great features; task bar, start menu, widgets page, and of course the desktop. The task bar includes the main features of your device; the start button, the browser, messaging, dialer, and the launcher. The launcher gives you a list of all installed applications and allows you to pick one to run. The start menu allo...

Computer acronyms

ADSL - Asymmetric Digital Subscriber Line AGP - Accelerated Graphics Port ALI - Acer Labs, Incorporated ALU - Arithmetic Logic Unit AMD - Advanced Micro Devices APC - American Power Conversion ASCII - American Standard Code for Information Interchange ASIC - Application Specific Integrated Circuit ASPI - Advanced SCSI Programming Interface AT - Advanced Technology ATI - ATI Technologies Inc. ATX - Advanced Technology Extended --- B --- BFG - BFG Technologies BIOS - Basic Input Output System BNC - Barrel Nut Connector --- C --- CAS - Column Address Signal CD - Compact Disk CDR - Compact Disk Recorder CDRW - Compact Disk Re-Writer CD-ROM - Compact Disk - Read Only Memory CFM - Cubic Feet per Minute (ft�/min) CMOS - Complementary Metal Oxide Semiconductor CPU - Central Processing Unit CTX - CTX Technology Corporation (Commited to Excellence) --- D --- DDR - Double Data Rate DDR-SDRAM - Double Data Rate - Synchronous Dynamic Random Access Memory DFI - DFI ...