Write a macro to find cube of a given number. 4m Jun 2010

By | August 13, 2016

Write a macro to find cube of a given number. 4m

Code:

#include<stdio.h>
#define CUBE(N) (N * N * N )
void main()
{
int NUM;
clrscr();
printf(” Enter number : “);
scanf(“%d”,&NUM);
printf(“\n Cube of number is : %d “,CUBE(NUM));
getch();
}

#include<stdio.h>
#define CUBE(N) (N * N * N )
void main()
{
int NUM;
clrscr();
printf(" Enter number : ");
scanf("%d",&NUM);
printf("\n Cube of number is : %d ",CUBE(NUM));
getch();
}

Screen Shots:

C_program_Macro_Cube

C_program_Macro_Cube_Out

 

 

(c) Write a program in C, using structures to generate a report for students which display Roll No. and Name of student, total marks obtained by the student. Assumptions can be made wherever necessary.

Solved program can be found on this link http://cssimplified.com/c-programming/a-c-program-to-process-the-students-evolution-records-using-structures

 

4. (a) Write a program and flowchart to display the following pattern : 8

H

He

HeL

HeLL

HeLLO

HeLL

HeL

He

H

Solved program can be found on this link http://cssimplified.com/c-programming/write-a-program-in-c-to-print-the-following-format-10m-dec2005