Solução: Bits Trocados - OBI (Jandson Nunes)

From AdonaiMedrado.Pro.Br
Revision as of 13:49, 29 April 2009 by 200.17.147.2 (Talk)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
#include <stdio.h>
 
int main () {
	int valor, cedulas[4] = {0}, teste = 1, i;
 
	scanf("%d", &valor);
	while (valor){
		cedulas[0] = valor / 50;
		valor = valor%50;
		cedulas[1] = valor/10;
		valor = valor%10;
		cedulas[2] = valor/5;
		valor = valor%5;
		cedulas[3] = valor;
		valor = 0;
		printf("Teste %d\n", teste);
		for (i = 0; i < 4; i++){
			printf("%d ", cedulas[i]);
			cedulas[i] = 0;
		}
		printf("\n\n");
		scanf("%d", &valor);
		teste++;
	}
}