Function that displays the alphabet in C ...

Fabrice -  
fiddy Posted messages 441 Registration date   Status Contributeur 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 réponses

jisisv Posted messages 3678 Status Modérateur 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
nizarre Posted messages 1 Status Membre
 
Hi, can you explain your code please?
0
[Dal] Posted messages 6205 Registration date   Status Contributeur Last intervention   1 108
 
0
zipe31 Posted messages 34620 Registration date   Status Contributeur Last intervention   6 500
 
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
Pacorabanix Posted messages 4122 Registration date   Status Membre Last intervention   663
 
Hint: The letters in C are encoded in a certain way. What is this way?
0
Fabrice
 
En dec
0
Fabrice
 
Nice!
0
Yeem
 
Can we do it without the main function?
0
titus22
 
WTF ?! You want to make a program without a main?
0
ano
 
which is entirely possible with gcc
0
fiddy Posted messages 441 Registration date   Status Contributeur Last intervention   1 847 > ano
 
I doubt it... The C standard requires a main() in a program...
0
CAPS
 
Hello;
and what would be the command to write the alphabet backwards?
different function?
0
fiddy Posted messages 441 Registration date   Status Contributeur Last intervention   1 847
 
No, you adapt the for()...
0