C

Saturday, 8 July 2017

Program to show nesting of macros

#include<stdio.h>
#define SQU(x)((x)*x)
#define CUBE(x)(SQU(x)*x)
int main()
{         
          int x,y;
          clrscr();
          x=SQU(3);
          y=CUBE(3);
          printf("\nSquare of 3 : %d",x);
          printf("\nCube of 3 : %d",y);
          return(0);

}

No comments:

Post a Comment

Write a program to draw a circle using mid-point circle drawing algorithm.

#include<iostream.h> #include<graphics.h> #include<conio.h> void drawcircle(int x0, int y0, int r) {         ...