Jump to content

Linguagem C-ajuda no termino da resoluçao


lidi_si
 Share

Recommended Posts

Daee galera!

acabei de fzr um código em c..mas to com duvida no termino da resoluçao dele..

nao to conseguind achar parte fracionaria e arredondamento;

aeww vai

#include<stdio.h>:
#include<stdlib.h>
main(){
      int num;
       float resposta;
       printf("Entre com numero real:");
       scanf("%d",&num);
       resposta=(float)num-resposta;
       printf("%2.0f",resposta);

       system("PAUSE");}
Link to comment
Share on other sites

#include<stdio.h>

#include<stdlib.h>

main(){

float numero;

int parte_inteira;

printf("Entre com um numero real com parte fracionaria:");

scanf("%f",&numero);

parte_inteira=(float)numero-parte_inteira;

printf("%d",parte_inteira);

system("PAUSE");}

Qual é a duvida?

Parece-me c++

e acho que te vai devolver o resto da divisao..

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.