23.12.19

square and cube program in c

#include<stdio.h>
#include<conio.h>
main()
{
int a,b,n;
clrscr();
printf("\n enter any number for cube and square value");
scanf("%d",&n);
a=n*n;
b=n*n*n;
printf("square is %d  and cube is %d",a,b)
getch();
}


OUTPUT

enter any number for cube and square value 3
square is 9 cube is 27

No comments:

Post a Comment

JAVA program pattern 2

import java.util.Scanner; public class pattern3 { public static void main(String args[]) { int i,j; Scanner sc=new Scanner(System.in); Syste...