Write a C program for Implementation of formula : c = a2 + 2ab + b2
Program:-
#include <stdio.h>
#include <math.h>
#include <conio.h>
void main()
{
int a,b, C;
clrscr();
printf("Enter the value of a and b");
scanf("%d%d",&a,&b);
c=pow(a,2)+pow(b,2)+(2*a*b);
printf("%d",C);
getch();
}
Output:-
input:-
Enter the value of a, b
a=2
b=2
Enter the value of a, b
a=2
b=2
output:-
16
16
0 comments:
Post a Comment