Write a C++ program to test if a given non-negative number is a multiple of 13 or it is one more than a multiple of 13

  • برمجة سي بلس بلس
  • برمجة

Write a C++ program to test if a given non-negative number is a multiple of 13 or it is one more than a multiple of 13

Sample Output:

1
1
1
0

الأجوبة

#include <iostream>
 
using namespace std;

bool test(int n)
        {
            return n % 13 == 0 || n % 13 == 1;
        }
     
        
int main() 
 {
  cout << test(13) << endl; 
  cout << test(14) << endl; 
  cout << test(27) << endl;     
  cout << test(41) << endl;     
  return 0;      
}
هل كان المحتوى مفيد؟

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...