# Creation d un programme en C

**URL:** <https://www.debian-fr.org/t/creation-d-un-programme-en-c/86293>\
**Category:** Programmation\
**Created:** [Mars 24, 2022, 7:05 UTC](https://www.debian-fr.org/t/creation-d-un-programme-en-c/86293 "2022-03-24T19:05:05Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![nicola](https://www.debian-fr.org/user_avatar/www.debian-fr.org/nicola/32/8969_2.png) [@nicola](https://www.debian-fr.org/u/nicola)\
**Post date:** [Avril 10, 2022, 11:49 UTC](https://www.debian-fr.org/t/creation-d-un-programme-en-c/86293/21 "2022-04-10T11:49:07Z")

</div>

C’est volontaire pour Python à la place de C.

---

<div class="post-metadata">

**Author:** ![vbreton](https://www.debian-fr.org/user_avatar/www.debian-fr.org/vbreton/32/11400_2.png) [@vbreton](https://www.debian-fr.org/u/vbreton)\
**Post date:** [Avril 10, 2022, 1:34 UTC](https://www.debian-fr.org/t/creation-d-un-programme-en-c/86293/22 "2022-04-10T13:34:26Z")

</div>

Voici @pat66 la réponse pour la création du programme en C:

```auto
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

void main(){
char snumber[4];
int flag;

for(int a=0; a<=789; a++){
    flag=1;
        sprintf(snumber,"%03d",a);
        for(int b=0; b<strlen(snumber)-1; b++){
            if(snumber[b]>=snumber[b+1]){
                flag=0;
                break;
                }
            }
        if (flag==1){
            printf("%03d\n",a);
        }
    }
}

```

Merci à @nicola pour nos échanges. Bien que le titre du fil soit «&nbsp;Création d’un programme en C&nbsp;», il peut être effectivement intéressant de le porter en Python:

```auto
for a in range(789):
    number=str(a).zfill(3)
    flag=1;
    for f in range (len(number)-1):
        if number[f]>=number[f+1]:
           flag=0;
           break;
    if flag==1:
        print(number)

```

[Page précédente](https://www.debian-fr.org/t/creation-d-un-programme-en-c/86293.md?page=1)
