Untitled
unknown
scheme
3 years ago
1.0 kB
1
Indexable
#include <stdio.h> struct lol{ int axe; int swords; int beans; int tiamat; }; void game(struct lol nenad); int main(){ struct lol marija; printf("\nInsert number of axes: "); scanf("%d", &marija.axe); printf("\nInsert number of swords: "); scanf("%d", &marija.swords); printf("\nInsert number of beans: "); scanf("%d", &marija.beans); printf("\nNumber of axes: %d", marija.axe); printf("\nNumber of swords: %d", marija.swords); printf("\nNumber of beans: %d", marija.beans); marija.tiamat=0; do{ marija.axe--; marija.swords--; marija.beans = marija.beans-2; marija.tiamat++; }while(marija.axe != 0 && marija.swords != 0 && marija.beans != 0); printf("\nNumber of tiamats is: %d", marija.tiamat); game(marija); return 0; } void game(struct lol nenad){ printf("\nRemaining number of axes: %d", nenad.axe); printf("\nRemaining number of swords: %d", nenad.swords); printf("\nRemaining number of beans: %d", nenad.beans); //printf("\nNumber of tiamats: ", nenad.); }
Editor is loading...