Function that displays the alphabet in C ...

Fabrice -  
fiddy Posted messages 441 Registration date   Status Contributor Last intervention   -
Hello,

I would like to know how to create these functions, I have three to find, I have been searching for an hour but ...

Write a function that displays the alphabet in lowercase on a single line, in ascending order starting from the letter 'a'.

--

Write a function that displays the alphabet in lowercase on a single line, in descending order starting from the letter 'z'.

--

Write a function that displays all the digits on a single line in ascending order.

--

I am just starting with C ...

Thank you in advance.

7 answers

  1. jisisv Posted messages 3678 Status Moderator 936
     
    johand@osiris: ~/src/CCM/C $ cat alphabet.c #include <stdio.h> int main(void){unsigned char c;for(c='a';c<='z';c++)putchar((int)c);return 0 ;}

    I'll leave you the task of formatting and creating a function...
    With a proper editor like Emacs, it's a piece of cake. Still, it’s important to leave some work.
    Johan

    --
    Gates gave ^H sold you the windows.
    GNU gave us the whole house.(Alexandrin)
    4
    1. nizarre Posted messages 1 Status Member
       
      Hi, can you explain your code please?
      0
  2. zipe31 Posted messages 34620 Registration date   Status Contributor Last intervention   6 501
     
    Hello,

    Ask for help with your exercises on CCM

    ;-)
    --
    Zen my nuggets ;-)
    Make a gesture for the environment, close your windows and adopt a penguin.
    2
  3. Pacorabanix Posted messages 4122 Registration date   Status Member Last intervention   663
     
    Hint: The letters in C are encoded in a certain way. What is this way?
    0
  4. Yeem
     
    Can we do it without the main function?
    0
    1. titus22
       
      WTF ?! You want to make a program without a main?
      0
    2. ano
       
      which is entirely possible with gcc
      0
      1. fiddy Posted messages 441 Registration date   Status Contributor Last intervention   1 847 > ano
         
        I doubt it... The C standard requires a main() in a program...
        0
  5. CAPS
     
    Hello;
    and what would be the command to write the alphabet backwards?
    different function?
    0
    1. fiddy Posted messages 441 Registration date   Status Contributor Last intervention   1 847
       
      No, you adapt the for()...
      0