Otro: Convertir float a int

convertir float a int.html
#include <stdio.h>

int main(){
	float a, b, producto;
	
	printf("Ingrese numero flotante 1: \n");
	scanf("%f",&a);
	fflush(stdin);
	printf("Ingrese numero flotante 2: \n");
	scanf("%f",&b);
	fflush(stdin);
	
	producto = a * b;
	
	printf("El producto de los numeros es %.2f\n", producto);
	printf("Convertir a entero: %d \n", (int)producto);
	
	system("pause");
	return 0;
}

No hay comentarios:

Publicar un comentario