Thursday, 4 November 2021

C Program to find square and cube of a given number

C Program to find square and cube of a given number

Program:-

#include<stdio.h>

#include<conio.h>

void main()

{

int n,sq,cu;

clrscr();

printf("Enter a no.");

scanf("%d",&n);   

sq=n*n;   

cu=n*n*n;   

printf("Square is %d",sq);

printf("Cube is %d",cu);

getch();

 }


 

Output:

Enter a no:2

Square is 4

Cube is 8

No comments:

Post a Comment

google-site-verification: google18ae80885fc3d876.html