What is wrong is solution of this question

#include
using namespace std;
int main()
{
long long int t;
cin>>t;
cout<<endl;
while(t!=0)
{
long long int n,b=0,c=0;
cin>>n;
long long int a[n];
for (long long int i = 0; i < n; ++i)
{
cin>>a[i];
}
if (n==1)
{
cout<<“yes”<<endl;
}
else if (n>1)
{
for (long long int i = 0; i < n; ++i)
{
if(a[i]==1 || a[i]==0)
{
b++;
break;
}
else
{
for (long long int j = 0; j < n; ++j)
{
if ( (i!=j) && (a[i]*a[j]==a[j]))
{
c++;
}
}
}
}
}
if (b>0 || c>0)
cout<<“yes”<<endl;
else
cout<<“no”<<endl;

	t--;
}
return 0;

}

a) Please format your code using “Preformatted Text” - the forum software sometimes mangles it so that we can’t copy-n-paste and compile it :slight_smile:

b) Which “question” is this a “solution” to?

1 Like

#include <stdio.h>

int main(void)
{
int x;
float y;
printf(“Enter amount to be withdrawn\n”);
scanf("%d",&x);
printf(“Enter bank balance with two digit precision\n”);
scanf("%f",&y);

if (x%5==0 && x<=(y-0.5))
{
    y=y-x-0.5;
    printf("%.2f",y);
}
else
{
    printf("%.2f",y);
}
return 0;

}
This is solution for ATM PROBLEM IN BEGGINERS (LAST ONE ) . IT SHOWS WRONG OUTPUT. PLEASE TELL WHAT IS PROBLEM?

Your output contains the strings “Enter amount to be withdrawn” and “Enter amount to be withdrawn” which are not part of the allowed Output Format.

1 Like

Thanks buddy, that really helped. I was getting frustrated because of it.

1 Like