Quantcast
Viewing all articles
Browse latest Browse all 39796

there is some problem with the solution of COINS question

#include<stdio.h>
int main()
{
int n[20],n1=0,n2=0,n3=0,i,len=0;
len=sizeof(n)/sizeof(int);
printf("pls enter any %d number:\n",len);
for(i=0;i<len;i++)
{
    scanf("%d",&n[i]);
    n1=n1+(n[i]/2);
    n1=n1+(n[i]/3);
    n1=n1+(n[i]/4);
    if(n[i]<n1)
    {
        n[i]=n1;
    }
    else
    {
        n[i]=n[i];
    }
    n1=0;
    printf("%d\n",n[i]);
}
return 0;
    }

there is some problem as the code above executes well then also it shows wrong answer pls help if u can


Viewing all articles
Browse latest Browse all 39796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>