need stack pseudo code for the following ASAP dom plastic container of Pez the c
ID: 3788602 • Letter: N
Question
need stack pseudo code for the following ASAP
Explanation / Answer
main()
{
int n,i,j,num[10],top[10={-1},ycnt=,i1=0,j1=0;
char c;
char candy[50][50],fcandy[50][50];
printf("enter number of plastic container");
scanf(%d",&n);
printf("number of candys present in %d plastic container",n);
for(i=0;i<n;i++)
scanf("%d",&num[i]);
printf("enter color for candy Y-->Yellow R-->Red B->BlackW-->White for each plastic container");
for(i=0;i<n;i++)
{
for(j=0;j<num[j];j++)
{
scanf("%c",&c);
top[i]++;
strcpy(candy[j][i],c);
}}
for(i=0;i<n;i++) {
for(j=0;j<num[j];j++) {
while(top[j]!=-1) {
if(strcmp(candy[[i][j],"Y")==0) {printf("yellow candy-you can eat"); ycnt++;
else {strcpy(fcandy[i1][j1],candy[i][j]);
i1++;
}
ftop[j1]=i1
j1++;
}
}
printf(remaining candy in plastic container")
for(i=0;i<n;i++){
for(j=0;j<ftop[j];j++){
printf (%c",fcandy[j][i]);
}
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.