Write a program to calculate the value of (a-b)2 in c

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

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

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

	total = (a*a) + (b*b) - (2*a*b);
	printf("%d", total);
}

kabeer

Added  Jul 23, 05:31 pm

Article tags

×
Google login
SignUp with Email
X