+ 1
Wil anyne plz spare ur time and solve this code??Its showing error..
3 Respuestas
+ 4
for(int i=0;i<n;i++)
{
scanf("%d",&arr[i]);
for(int i=0;i<=(i/2);i++) //here again reinitializing i again, will result may confusion or undefend behaviour.. Am i<i/2 never true,
{
for(int j=n;j<=(i/2)+1;j--) this also,
{
Edit:
Amirtha K By first loop, take all inputs so, close brace} there, not include it to next loops,..
And you don't need 2 loop next, 1 is enough, otherwise you compare double times, intilize i, j in 1loop, simultaneously do i++, j--.
And condition for j is j>=(n/2), not <=.
Try these changes now...
+ 1
Good one, just for information I'm adding this code, which is reduced more, take a look..
#include <stdio.h>
int main()
{
int n,arr[30],c,b,d;
scanf("%d",&n);
for(int i=0;i<n;i++) //remove =
scanf("%d",&arr[i]);
//here any 1 condition is enough but adding 2
for(int i=0,j=n-1;i<(n/2) && j>=(n/2);i++,j--)
{
//not need if..
c=arr[i]+arr[j];
b=c/10;
d=c%10;
printf ("%d ",b);
printf ("%d\n",d);
}
return 0;
}
And You're welcome...
- 1
Haiyooo...U hlped me a lottt...But all i can say is a virtual thanks from the bottom of my heart..Really thanx a lott..I'm getting it😁😁😁😍😇😇😇Eeeeeeeeeeeee