Tuesday, November 07, 2017

Write a Program (WAP) to print the cube of the given number.


void main()
    int number;  
    printf("enter a number:");  
    printf("cube of number is:%d ",number*number*number);  


enter a number:5
cube of number is:125

¾     In int number; int is the data type and number is the variable name (both discuss later).
¾     The scanf() function is used for input. It reads the input data from the console.
¾     The scanf("%d",&number) statement reads integer number from the console and stores the given value in number variable.
¾     The syntax of scanf() function is given below:

scanf("format string",argument_list)

The printf("cube of number is:%d ",number*number*number) statement prints the cube of number on the console.

No comments:

C language Introduction

Definition of C Language The C Language is developed for creating system applications that directly interact to the hardware devic...