Write a program to calculate the value of (a+b)3 in c

Write a program to calculate the value of the given expression: (a+b)3. Take the values of a, b as input from the console.

#include<stdio.h>
void main() {
	int a,b,x;
    
	printf("Enter the value of a\n");
	scanf("%d", &a);

	printf("Enter the value of b\n");
	scanf("%d", &b);

	x = (a*a*a) + (b*b*b) + (3*a*a*b) + (3*b*b*a);

	printf("%d", x);
}

kabeer

Added  Jun 21, 04:18 pm

Article tags

×
Google login
SignUp with Email
X