-1

it's my first time posting in here! I know that my question doesn't sound really correct, but I'm really new to programming. In my program, I need that if a user enters a number (1 <= 365) then the program will tell which day is it. Then I came up with a solution but I don't know if C++ can even do it. For example, if A/7= 3.6 and B/7= 2.1 or C/7=2.9 then it'll read the last decimal and do a different if function every time (for example if it ends with .6 program then says it's Thursday and .9 it's Sunday and so on and so on). I hope it kind of makes sense. Thanks

#include <cstdio>
main()
{
  float n, D; 
  printf("Enter the number of the day n:\n");
  scanf("%f", &n);
  D = n/7
  if (D = )/*here I'm trying that if D ends with some number it'll do this*/
  { 
  printf("It's Monday")
  }
}
Zaid Aly
  • 163
  • 1
  • 17
Rasmus
  • 1
  • 1

1 Answers1

1

How about multiply 10 then '%' to get the remainder?

Rzy
  • 11
  • 2