0% found this document useful (0 votes)
11 views2 pages

C Language Activity

The document provides a C program that prompts users to enter their first and last names, as well as two numbers, and then calculates and displays their sum, product, and average. Additionally, it outlines an activity to create a Java program based on specified questions involving geometric calculations and unit conversions, with instructions for submission. The deadline for submitting the document is July 13 at 11:59 PM.

Uploaded by

Matt Requintel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views2 pages

C Language Activity

The document provides a C program that prompts users to enter their first and last names, as well as two numbers, and then calculates and displays their sum, product, and average. Additionally, it outlines an activity to create a Java program based on specified questions involving geometric calculations and unit conversions, with instructions for submission. The deadline for submitting the document is July 13 at 11:59 PM.

Uploaded by

Matt Requintel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Sample in Java ( this link is the Java online complier)

[Link]

#include <stdio.h>

int main() { This program will enter Firstname and Lastname


char firstname[50], lastname[50]; and it will display the Fullname.
int num1, num2, sum, product;
float average;
Also, you can enter 1st number and 2nd number
that will generate and display the following
// Input Firstname and Lastname operation.
printf("Enter your Firstname: ");
scanf("%s", firstname);
Sum, Product and Average.

printf("Enter your Lastname: "); Output:


scanf("%s", lastname);

// Display Fullname
printf("Your Fullname is: %s %s\n\n", firstname, lastname);

// Input two numbers


printf("Enter 1st number: ");
scanf("%d", &num1);

printf("Enter 2nd number: ");


scanf("%d", &num2);

// Calculations
sum = num1 + num2;
product = num1 * num2;
average = (num1 + num2) / 2.0;

// Display results
printf("\nResults:\n");
printf("Sum: %d\n", sum);
printf("Product: %d\n", product);
printf("Average: %.2f\n", average);

return 0;
}

Activity. Create a Java Program that will enter according to the needed specification from each question.

Instruction.
1) Open a MSWORD and place your answer here and save using *.doc file.
2) Just like in the above sample. Please do the same thing, copy the code and sample output from
question 1 to 5 to the document (MSWORD)
3) Deadline will be on July 13 (Sunday) at exactly 11:59pm
4) submit you document at the Gdrive posted at the GC.

1. Enter 2 numbers for the base and height of the Area of Triangle.
Formula: Area of Triangle = 1/2 × b × h

2. Enter 2 numbers for the length and breadth of the Perimeter of Rectangle.
Formula: Perimeter of Rectangle = 2(l + b)
3. Enter 3 numbers for the base1, base2 and the height of the Trapezoid.
Formula: Trapezoid = 1/2 × (b1 + b2) × h

4. Enter a number for feet and convert this to inches and meter
1 foot = 12 inches
1 foot = 0.3048 meter

5. Enter a number for liter and convert this to the following:


1 milliliter = 0.001 liter
1 centiliter = 0.01 liter
1 deciliter = 0.1 liter

You might also like