Thread: Ascending Numbers Help Only "C"

  1. #1
    Registered User
    Join Date
    Sep 2010
    Posts
    2

    Talking Ascending Numbers Help Only "C"

    i have a problem in this 1 of my problem!!!!
    can you solve this one for me!!!! or post here your program!!!!
    only "C" please

    here's my program!!:
    Code:
    #include<stdio.h>
    #include<conio.h>
    
    int main(void)
    
    { 
        int array[10], t, x;
            
        for (x=0; x<10; x++)
        {
            printf("Enter integer number:\n ");
            scanf("%d", &array[x]);
            }
                    if(array[x] < array[x+1])
                    
                                           t=array[x];
                                           array[x]=array[x+1];
                                           array[x+1]=t;
            
         
            printf("The integers in ascending order are : ");
            
            for (x=0;x<10;x++)
            printf("%d\n", array[x]);
                
                
                getch();
                }
    Input is:
    5 6 2 4 3 1 7 90 23 41 45 24
    The correct Output is:
    1 2 3 4 5 6 7 23 24 41 45 90

  2. #2
    Password:
    Join Date
    Dec 2009
    Location
    NC
    Posts
    587
    Yes!!! I could, but I don't spend my time doing other's homework!!! Bubble sort is extremely easy, use it.

  3. #3
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,817
    Quote Originally Posted by xcurialz View Post
    only "C" please
    So... you want C help but out of all the different boards you could have posted to you choose the C++ one? You do know there is a separate board for just C right? It would help to choose the right one to post in.
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Moved
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User
    Join Date
    Oct 2006
    Posts
    250
    Quote Originally Posted by User Name: View Post
    Yes!!! I could, but I don't spend my time doing other's homework!!! Bubble sort is extremely easy, use it.
    I think you're missing a bunch of exclamation marks at the end of your sentence!!!
    iMalc: Your compiler doesn't accept misspellings and bad syntax, so why should we?
    justin777: I have no idea what you are talking about sorry, I use a laptop and there is no ascii eject or something

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. trying to reverse numbers with sizeof operator
    By JoelearningC in forum C Programming
    Replies: 13
    Last Post: 03-09-2008, 11:53 AM
  2. Program that prints numbers in columns
    By rayrayj52 in forum C++ Programming
    Replies: 12
    Last Post: 09-20-2004, 02:43 PM
  3. the definition of a mathematical "average" or "mean"
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 12-03-2002, 11:15 AM
  4. Line Numbers in VI and/or Visual C++ :: C++
    By kuphryn in forum C++ Programming
    Replies: 2
    Last Post: 02-10-2002, 10:54 PM
  5. A (complex) question on numbers
    By Unregistered in forum C++ Programming
    Replies: 8
    Last Post: 02-03-2002, 06:38 PM

Tags for this Thread