C Language Program to Determine if a Number is Even or Odd

C Language Program to Determine if a Number is Even or Odd

Determine if a number is even or odd #define _CRT_SECURE_NO_WARNINGS#include <stdio.h>#include <stdlib.h> // system function required int main(){ int a; while (1) // infinite loop { printf("Please enter an integer:\n"); scanf("%d", &a); if (a % 2 == 0) { printf("%d is even\n", a); } else { printf("%d is odd\n", a); } printf("Press any key to … Read more

C++ Practice Problem – Nicomachus’s Theorem

C++ Practice Problem - Nicomachus's Theorem

Time Limit: 2s Memory Limit: 192MB Problem Description Verify Nicomachus’s theorem, which states that the cube of any integer m can be expressed as the sum of m consecutive odd numbers. Input Format Any positive integer Output Format The cube of the number decomposed into a series of consecutive odd numbers Sample Input 13 Sample … Read more