Computer Science, asked by shehalasherin5149, 10 months ago

Write a program to find the sum of 12.7 and 20.6 . Also subtract 20 from 23 . Print both the results .

Answers

Answered by gopimythili111
12

Answer:

In sum, consider float data type and in difference consider int data type

Explanation:

1. #include<stdio.h>

main()

{

float a=12.7,b=20.6,c;

c=a+b;

printf("Sum is %f",c);

}

2. #include<stdio.h>

main()

{

int a=23,b=20,c;

c=a-b;

printf("Difference is %d",c);

}

Answered by AskewTronics
1

Program in python language:

Explanation:

print(12.7+20.6)#add the 12.7 and 20.6

print(23-20)#subtract the 20 from 23.

Output:

  • The above code will prints the output as "33.3" and "3" in seprate lines.

Code Explanation:

  • The above code is in python language, in which the first line will print the addition of 12.7 and 20.6 with the help of print function. The '+' symbols work as an addition operator here which is used for addition.
  • Then the second line is used to subtract 20 from 23, and the result is printed with the help of print function.

Learn More:

  • Python :  https://brainly.in/question/14689905
Similar questions