Write a C program to perform the arithmetic operation. Here, the preprocessor replaces "printf" in place of "out" and "scant" in place of "in" before compilation of program. Therefore, the word can be defined as macro. Note** #define out printf** #define in scanf.
Input:
6.5
3.3
Output:
9.8
#include <stdio.h>
#define out printf
#define in scanf
int main()
{
float n1, n2;
out("Enter number a: ");
in("%f", &n1);
out("Enter number b: ");
in("%f", &n2);
out("\nOutput:\n");
out("%.1f\n", n1+n2);
}
Comments
Leave a comment