Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Input two numbers and work out their sum, average and sum of the squares of the

ID: 3725720 • Letter: I

Question

Input two numbers and work out their sum, average and sum of the squares of the numbers.

Input and output your name, address and age to an appropriate structure.

Write a program that works out the largest and smallest values from a set of 10 inputted numbers.

Write a program to read a float representing a number of degrees Celsius, and print as a float the equivalent temperature in degrees Fahrenheit. Print your results in a form such as 100.0 degrees Celsius converts to 212.0 degrees Fahrenheit

Write a program to print several lines (such as your name and address). You may use either several printf instructions, each with a newline character in it, or one printf with several newlines in the string.

Write a program to read a positive integer at least equal to 3, and print out all possible permutations of three positive integers less or equal to than this value.

Write a program to read a number of units of length (a float) and print out the area of a circle of that radius. Assume that the value of pi is 3.14159. Your output should take the form:

Given as input a floating (real) number of centimeters, print out the equivalent number of feet (integer) and inches (floating, 1 decimal), with the inches given to an accuracy of one decimal place. Assume 2.54 centimeters per inch, and 12 inches per foot. If the input value is 333.3, the output format should be:

Given as input an integer number of seconds, print as output the equivalent time in hours, minutes and seconds. Recommended output format is something like

Explanation / Answer

Input two numbers and work out their sum, average and sum of the squares of the numbers.

#include<stdio.h>

main()

{

int a, b;

printf("Enter two numbers: ");

scanf("%d%d",&a, &b);

int c = a + b;

printf("The sum is: %d",c);

printf(" average is: %f",(c/2.0));

printf(" Sum of squares is: %d",(a*a + b*b));

}

Write a program that works out the largest and smallest values from a set of 10 inputted numbers.

#include<stdio.h>

main()

{

int a[10];

printf("Enter 10 numbers: ");

for(int i = 0 ; i < 10 ; i++)

scanf("%d",&a[i]);

int max, min;

max = min = a[0];

for(int i = 1 ; i < 10 ; i++)

{

if(max < a[i])

max = a[i];

if(min > a[i])

min = a[i];

}

printf("Max is: %d Min is: %d",max,min);

}

Write a program to read a float representing a number of degrees Celsius, and print as a float the equivalent temperature in degrees Fahrenheit. Print your results in a form such as 100.0 degrees Celsius converts to 212.0 degrees Fahrenheit

#include<stdio.h>

main()

{

float cel, far;

printf("Enter temperature in celcius: ");

scanf("%f",&cel);

far = (9 * cel) / 5 + 32;

printf("%0.2f degrees Celcius converts to %0.3f Farenheit.",cel,far);

}

Write a program to print several lines (such as your name and address). You may use either several printf instructions, each with a newline character in it, or one printf with several newlines in the string.

#include<stdio.h>

main()

{

printf("My nam is: Shashank Shukla ");

printf("Address: 9/4 Sector-21 Malibu. ");

printf("Age: 25");

}

Write a program to read a number of units of length (a float) and print out the area of a circle of that radius. Assume that the value of pi is 3.14159. Your output should take the form:

#include<stdio.h>

main()

{

float n;

printf("Enter The Radius: ");

scanf("%f",&n);

float area = 3.14159 * n * n;

printf("The area of a circle of radius %0.3f units is %f units",n , area);

}

Given as input a floating (real) number of centimeters, print out the equivalent number of feet (integer) and inches (floating, 1 decimal), with the inches given to an accuracy of one decimal place. Assume 2.54 centimeters per inch, and 12 inches per foot. If the input value is 333.3, the output format should be:

#include<stdio.h>

main()

{

float n;

printf("Enter The centimeters: ");

scanf("%f",&n);

float inch = n / 2.54;

int foot = (int) inch / 12;

inch = inch - (foot * 12);

printf("%0.1f centimeters is %d feet %0.1f inches",n , foot, inch);

}

Given as input an integer number of seconds, print as output the equivalent time in hours, minutes and seconds

#include<stdio.h>

main()

{

int n;

printf("Enter The Seconds: ");

scanf("%d",&n);

int min = n / 60;

int hour = min / 60;

min = min - (hour * 60);

int sec = n - ( (hour * 60 * 60) + min * 60);

printf("%d seconds is equivalent to %d hours %d minutes %d seconds",n ,hour, min, sec);

}

Input and output your name, address and age to an appropriate structure.

#include<stdio.h>

main()

{

char name[100], address[100];

int age;

printf("Enter Your Name: ");

gets(name);

printf("Enter Your Address: ");
gets(address);
printf("Enter Age: ");
scanf("%d",&age);

printf("Name: %s Address: %s Age: %d",name,address,age);

}