bsc

Comprehensive codebase and cou...
Log | Files | Refs | README | LICENSE

luc053.c (1266B)


      1 /*
      2  * Author  : Amit Dutta <amitdutta4255@gmail.com>
      3  * Date    : 08 Feb 2026
      4  * Repo    : https://github.com/notamitgamer/bsc
      5  * License : MIT License (See the LICENSE file for details)
      6  */
      7 
      8 /* Write macro definitions for: Mean, Absolute value, Uppercase to Lowercase, Biggest of three.
      9 */
     10 /* Let Us C, Chap- 12 (The C Preprocessor), Qn No.: C(b) */
     11 /* This file is auto-generated by a bot. */
     12 /* This code is not compiled; it is for reference only. */
     13 
     14 
     15 #include <stdio.h>
     16 #include <math.h>
     17 #include <stdlib.h>
     18 
     19 #define MEAN(x, y) ((x + y) / 2.0)
     20 #define ABS(x) ((x) < 0 ? -(x) : (x))
     21 #define TO_LOWER(x) ((x) >= 'A' && (x) <= 'Z' ? (x) + 32 : (x))
     22 #define MAX(x, y, z) ((x) > (y) ? ((x) > (z) ? (x) : (z)) : ((y) > (z) ? (y) : (z)))
     23 
     24 int main()
     25 {
     26     int a, b, c, num;
     27     char ch;
     28 
     29     printf("Enter two numbers for Mean: ");
     30     scanf("%d %d", &a, &b);
     31     printf("Mean: %.2f\n\n", MEAN(a, b));
     32 
     33     printf("Enter a number for Absolute value: ");
     34     scanf("%d", &num);
     35     printf("Absolute: %d\n\n", ABS(num));
     36 
     37     printf("Enter an uppercase character: ");
     38     scanf(" %c", &ch);
     39     printf("Lowercase: %c\n\n", TO_LOWER(ch));
     40 
     41     printf("Enter three numbers: ");
     42     scanf("%d %d %d", &a, &b, &c);
     43     printf("Biggest: %d\n", MAX(a, b, c));
     44 
     45     return 0;
     46 }
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror