#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
	int x=1;
	float b, c, d, e, f;
	char a[15], ver;
	
	do
	{
	printf("\n\nNome do Produto %i (Ate 15 caract.):",x);
	scanf(" %s",&a);
	printf("\n\nPreco do Produto %i:",x);
	scanf("%f",&b);
	
	printf("\n\nNome: Produto%i:\n%s\n", x, a);
	printf("\nPreco: Produto%i:\n%f\n\n\n", x, b);
	
	d+=b;
	
	printf("Proximo Produto? (S ou N):\n");
	scanf(" %c",&ver);
	if(ver == 'S')
	{
		x++;
	}
	else if(ver == 'N')
	{
		do
		{
		printf("\n\n\n\n\nTotal:\n%f", d);
		printf("\n\nValor pago\n:");
		scanf("%f", &e);
		
		if(e >= d)
		{
			f=e-d;
			printf("\nTroco:%f",f);
		}
		else if(e < d)
		{
			f=d-e;
			printf("\nFaltam:%f", f);
			f=0;
		}
	    }
		while(e < d);
	}
    }
	while(ver == 'S' && x <= 50);
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: