Computer Science, asked by shleshamogli, 5 months ago


Write a program to declare one integer variable and one float variable and
give them appropriate values using scanf(). You are required to print the two
numbers and their average. Write an output.​

Answers

Answered by jai696
6

\huge\red{\mid{\fbox{\tt{Using\: C}}\mid}}

#include <stdio.h>

int main()

{

int myInt;

float myFloat, average;

printf("Enter an integer: ");

scanf("%d", &myInt);

printf("Enter a float: ");

scanf("%f", &myFloat);

printf("myInt: %d\nmyFloat: %.2f\n", myInt, myFloat);

printf("Average: %.2f", (myInt + myFloat) / 2);

return 0;

}

\large\mathsf\color{lightgreen}useful?\: \color{white}\longrightarrow\: \color{orange}brainliest!

Answered by amaansayyedcr007
0

Answer:

#include <stdio.h>

int main()

{

int a;

float myFloat, average;

printf("Enter an integer: ");

scanf("%d", &a);

printf("Enter a float: ");

scanf("%f", &myFloat);

printf("a: %d\nmyFloat: %.2f\n",a, myFloat);

printf("Average: %.2f", (a + myFloat) / 2);

}

Explanation:

Similar questions