• Log in or sign up for an account here: https://www.sythe.org/login

what worng with my script (c)

M_A_D

Active Member
Banned
Joined
Apr 8, 2006
Sythe Gold
0
Messages
212
what worng with my script (c)
well i know i am noob i am trying to learn this

i tryed to do a script that get 10 numbers and printt it from the lowest to the highest

what worng with this script


#include <stdio.h>
#include <conio.h>

void main( )
{
int i, g, z;
int A[10]; // New array with 10 cells non initialized

for (i=0;i<10;i++)

{
scanf ("%d", &g);
A= g ;
}

for (i=0;i<9;i++)
{
if (A[i-1]>A)

A[i-1]=z;
A=A[i-1];
A[i-1]=A;
}
printf("A = %d\n", A) ;

getch();
//return 0;
}
 
what worng with my script (c)
At least post what the error/exception was.
 
what worng with my script (c)
i supposed to get 10 numbers from the lowest to the highest and 10 times same default number ( -85899...)
 
what worng with my script (c)
>____>

Program dude, program.

Start to call it that instead of a script and you'll sound much better already.
 
what worng with my script (c)
look i just start doing it so i dont know names i dont know alot of things if i dont know tell me u dont have to tallk like that this is annoying


and i know i speak like 13 year old kid but i am not i do it because englise aint my first language


any one can do a real help?
 
what worng with my script (c)
For starters, I don't know what you are scanning.

Code:
#include <stdio.h>
#include <conio.h>

void main( )
{
int i, g, z;
int A[10]; // New array with 10 cells non initialized

for (i=0;i<10;i++)

{
scanf ("%d", &g); //I don't know what you are scanning here. Since loop starts and end in order, why not try to get a user input?
A[i]= g ;
}

for (i=0;i<9;i++)
{
if (A[i-1]>A[i])

A[i-1]=z;
A[i]=A[i-1];
A[i-1]=A[i];
}
printf("A[i] = %d\n", A[i]) ;

getch();
//return 0;
}
 
Runescape Gamblingrunescape gambling
Back
Top