Guest_imported
New member
- Jan 1, 1970
- 0
I'm learning my selfC-programming and i don't know what's wrong with my FIRST C-program. So i need bit help..
#include <stdio.h>
void main(void)
{
int sumab,sumvo,summw,sumta;
int saabs,volvos,bmws,toyotas;
printf("Traffic-counter\n\n"
printf("1 - Saab\n"
printf("2 - Volvo\n"
printf("3 - Bmw\n"
printf("4 - Toyota\n"
printf("0 - End session\n\n"
/*Printing instructions*/
printf("Give vehicle code:" /*Printing request for user*/
while ("%d">=1&&"%d"<=4);
{
if ("%d"==1)
{
scanf("%d", &saabs);
sumab +=saabs;
}
else if ("%d"==2)
{
scanf("%d", &volvos);
sumvo +=volvos;
}
else if ("%d"==3)
{
scanf("%d", &bmws);
summw +=bmws;
}
else if ("%d"==4)
{
scanf("%d", &toyotas);
sumta +=toyotas;
}
if ("%d"==0)
{
printf("There were following vehicles:\n"
printf("&d Saabs\n",sumab);
printf("%d/2 Volvos\n",sumvo);
printf("%d/3 Bmws\n",summw);
printf("%d/4 Toyotas\n",sumta);
}
return 0;
}
#include <stdio.h>
void main(void)
{
int sumab,sumvo,summw,sumta;
int saabs,volvos,bmws,toyotas;
printf("Traffic-counter\n\n"
printf("1 - Saab\n"
printf("2 - Volvo\n"
printf("3 - Bmw\n"
printf("4 - Toyota\n"
printf("0 - End session\n\n"
/*Printing instructions*/
printf("Give vehicle code:" /*Printing request for user*/
while ("%d">=1&&"%d"<=4);
{
if ("%d"==1)
{
scanf("%d", &saabs);
sumab +=saabs;
}
else if ("%d"==2)
{
scanf("%d", &volvos);
sumvo +=volvos;
}
else if ("%d"==3)
{
scanf("%d", &bmws);
summw +=bmws;
}
else if ("%d"==4)
{
scanf("%d", &toyotas);
sumta +=toyotas;
}
if ("%d"==0)
{
printf("There were following vehicles:\n"
printf("&d Saabs\n",sumab);
printf("%d/2 Volvos\n",sumvo);
printf("%d/3 Bmws\n",summw);
printf("%d/4 Toyotas\n",sumta);
}
return 0;
}