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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

is there eligible for computer science engg students to write exams and how much percentage we want to attempt exam based on degree

1472


what is need of interface. what is the diff b/w interface and abstract class

1374


which type of casting enforces type safety

3256


How many of 14 digit numbers we can make with 1,2,3,4,5 that are divisible by 4. Repetitions allowed.

1834


Implement the dictionary operations INSERT, DELETE, and SEARCH using singly linked, circular lists. What are the running times of your procedures?

4999






how to find out the name of the users who are currently working starting with the same characters in unix os

1473


compair and contrast procedrual and object oriented programming language

1319


what is a structure in c language?

1361


A bar of steel 24 mm in diameter was subjected to a tensile load of 60 kNs and measured extension on a 20-cm gauge length was 0.009 cm and the change in diameter was 0.00375 cm. Calculate the Bulk modulus?

1570


what is the difference between public static void main (String args[]) and static public void main(String args[]) in java?

2376


why unix commands simpler rather than complex task

2378


how will u recieve idoc

1568


write a c program which accepts input as Anu.B.Kapoor and gives output as:Kapoor.A.B plz send me the ans

1137


how to use two diffirent gatway in one system

1406


There are n points and each point enclose with x and y axis form a rectangle and find the point using a program which forms the smallest rectangle?

1435