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
What is RAC?(Real Application Cluster).Explain in Detail.
what is the difference betweeen far pointer and near pointer
what does complexity means in an algorithim?? how it is calcutaed?
what is need of interface. what is the diff b/w interface and abstract class
sir, plz send me the question regarding DMS gr1 questions of previous year as my exam is on 27/09/08...thanking u in advance...
why not overloading -,=,_,\ operator
difference between windows 2003 and windows 2008 server
what is Networking?
Write steps of retrieving data using ado.net?
I am 2012 pass out b tech student(cse). i have recently started software manual testing class. Is this field is benefitial for me in future?
how to initialize a pointer to an array?
What is necking in production engineering ?
how am i supposed to convert a class program in C++ to Matlab? Do i also need to make classes in matlab too or I can do it without making classes???Can somebody help....
how to convert postfix notation into prefix in data structures. please send me algo of taha
If any kind of accident happen without any information to any one .what kind of action we have to take