Jump to content
Fórum Script Brasil
  • 0

linguagem c


wenesga
 Share

Question

1 answer to this question

Recommended Posts

  • 0

No Google tem muitos exemplos. Aqui nesse mesmo fórum já foi mencionado

#include <stdio.h>

int inverte ( int num ) {
    int num_inv = 0;
    
    while ( num > 0 ) {
        num_inv = num_inv * 10 + num % 10;
        num /= 10;
    }
    
    return num_inv;
}

int main() {
    int numero;
    scanf ( "%d", &numero );
    printf ( "\n%d - %d\n", numero, inverte ( numero ) );
    return 0;
}

Tenta entender ele antes de usar ou nunca aprenderás ;)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Forum Statistics

    • Total Topics
      149.8k
    • Total Posts
      646.6k
×
×
  • Create New...