I am only just learning this. I am trying to create a program in my own way instead of doing exactly what the tutorial says. What I am trying to do is print only a remainder of a simple division if the program divides a value by itself and the number isn't 1. Maybe you can follow my code. Haha sry if its tough to follow it I am very new to this:
Code:
#include <stdio.h>
#include <math.h>
#define YARDS_PER_SWEATER 460
#define YARDS_PER_HAT 220
int main(void) {
int num_balls, yards_per_ball;
int num_h, num_s;
float yards_left;
printf("How many balls of yarn do you have?\n");
scanf("%d" , &num_balls);
printf("How many yards are in each of your balls of yarn?\n");
scanf("%d" , &yards_per_ball);
num_h = (num_balls*yards_per_ball)/(YARDS_PER_HAT);
num_s = (num_balls*yards_per_ball)/(YARDS_PER_SWEATER);
if ((num_h||num_s)/(num_h||num_s) != 1)
printf("You have some yarn left over after you make %d sweaters or %d hats for other projects,\nif you want to know how many yards you have, type 'yes' below.\n" , num_s, num_h);
scanf("%d%d%d" , &Y, &E, &S);
yards_left = num_h
else if ((num_h||num_s)/(num_h||num_s) == 1))
print("You can make %d sweaters or %d hats, but you have no yarn left over.")
getchar();
return 0;
}