Write a program that finds the minimum total number of
shelves, including the initial one required for this loading
process.



Write a program that finds the minimum total number of shelves, including the initial one required ..

Answer / raveathul farzaana.m.y

#include<stdio.h>
#include<conio.h>
void main()
{
char packet[25];
int
n,counta=0,countb=0,countc=0,countd=0,counte=0,countf=0,countg=0,counth=0,counti=0,countj=0,countk=0,countl=0,countm=0,countn=0,counto=0,countp=0,countq=0,countr=0,counts=0,countt=0,countu=0,countv=0,countw=0,countx=0,county=0,countz=0;
int shelves=0;
printf("Enter the number of packets:");
scanf("%d",&n);
printf("Enter the packets one by one:");

for(i=0;i<n;i++)
{
scanf("%c",&packet[i]);
}
for(i=0;i<n;i++)
{
if(a[i]==A)
counta++;
if(a[i]==B)
countb++;
if(a[i]==C)
countc++;
if(a[i]==D)
countd++;
if(a[i]==E)
counte++;
else if(a[i]==F)
if(a[i]==G)
countg++;
countif(a[i]==H)
counth++;
if(a[i]==I)
counti++;
if(a[i]==J)
countj++;
if(a[i]==K)
countk++;
if(a[i]==L)
countl++;
if(a[i]==M)
countm++;
if(a[i]==N)
countn++;
if(a[i]==O)
counto++;
if(a[i]==P)
countp++;
if(a[i]==Q)
countq++;
if(a[i]==R)
countr++;
if(a[i]==S)
counts++;
if(a[i]==T)
countt++;
if(a[i]==U)
countu++;
if(a[i]==V)
countv++;
if(a[i]==W)
countw++;
if(a[i]==X)
countx++;
if(a[i]==Y)
county++;
if(a[i]==Z)
countz++;
}
if(n>0)
{
if(counta>0)
shelves++;
if(countb>0)
shelves++;
if(countc>0)
shelves++;
if(countd>0)
shelves++;
if(counte>0)
shelves++;
if(countf>0)
shelves++;
if(countg>0)
shelves++;
if(counth>0)
shelves++;
if(counti>0)
shelves++;
if(countj>0)
shelves++;
if(countk>0)
shelves++;
if(countl>0)
shelves++;
if(countm>0)
shelves++;
if(countn>0)
shelves++;
if(counto>0)
shelves++;
if(countp>0)
shelves++;
if(countq>0)
shelves++;
if(countr>0)
shelves++;
if(counts>0)
shelves++;
if(countt>0)
shelves++;
if(countu>0)
shelves++;
if(countv>0)
shelves++;
if(countw>0)
shelves++;
if(countx>0)
shelves++;
if(county>0)
shelves++;
if(countz>0)
shelves++;
printf(shelves)
}
else
{
printf("-1");





cont... after this

Is This Answer Correct ?    17 Yes 3 No

Post New Answer

More Engineering AllOther Interview Questions

i need to alone print a number no text by using if statement .say some idea

0 Answers  


can u perform addition of two octal numbers using java?

0 Answers  


A rectangular beam section of 300 mm width and 500 mm effective depth is reinforced with 4 bars of 20 mm diameter, what shear reinforcement is required to resist 200 kN shear (use working stress method)?

0 Answers  


Has anyone attended interviews in IITs for positions like Research fellowships/assistants? If yes, please share the experience about how complex the interview was, etc. etc.

0 Answers  


requirement:To move display statements in a cobol program to a dataset.These display statements were not in main program but in calling program and we were not allowed to move these info via sysout dd dsn='dataset.name' . please let me know the ways this can be handled

0 Answers   Verizon,






what is static identifier in c language?

0 Answers  


1.what a diffrenrs v-lan & (layer)l-3,l-2 bitween plz define defination of these? 2.how to configur ms outlook & lotus note (ibm)

0 Answers  


my first question in huawei was ....1)Tell me about your self 2) oops concept 3)logic gates 4)ram and rom ,what is cache memory nd where it is located 5)diffrence between file system and data base 6) procedure of operating system 7)what is c# 8)high level language and machine language 9) and from mobile networkin !!!! hope thz will help you

0 Answers   Huawei,


List three things you can do with the files you create by recording your voice on your computer

0 Answers  


1)what is output for the following program. #include<stdio.h> main() { int *p,*q,i; p=(int *)100; q=(int *)200; i=q-p; printf("%d",i); } a)100 b)25 c)0 d)compile error

1 Answers   Infosys,


why there is a collision in switch

0 Answers  


There are prime factors of two numbers a and b , write a program using this prime factors whether a is divisible by b?

0 Answers  


Categories
  • Civil Engineering Interview Questions Civil Engineering (5085)
  • Mechanical Engineering Interview Questions Mechanical Engineering (4451)
  • Electrical Engineering Interview Questions Electrical Engineering (16632)
  • Electronics Communications Interview Questions Electronics Communications (3918)
  • Chemical Engineering Interview Questions Chemical Engineering (1095)
  • Aeronautical Engineering Interview Questions Aeronautical Engineering (239)
  • Bio Engineering Interview Questions Bio Engineering (96)
  • Metallurgy Interview Questions Metallurgy (361)
  • Industrial Engineering Interview Questions Industrial Engineering (259)
  • Instrumentation Interview Questions Instrumentation (3014)
  • Automobile Engineering Interview Questions Automobile Engineering (332)
  • Mechatronics Engineering Interview Questions Mechatronics Engineering (97)
  • Marine Engineering Interview Questions Marine Engineering (124)
  • Power Plant Engineering Interview Questions Power Plant Engineering (172)
  • Textile Engineering Interview Questions Textile Engineering (575)
  • Production Engineering Interview Questions Production Engineering (25)
  • Satellite Systems Engineering Interview Questions Satellite Systems Engineering (106)
  • Engineering AllOther Interview Questions Engineering AllOther (1379)