Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Day 2 assignment #6

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

anonfedora
Copy link

Add Functions for Arithmetic Operations, String Manipulation, and Even Check

Description

This PR introduces the following features to enhance the functionality of the application:

  1. Check if the Sum of Two Integers is Even

    • Added is_even(x: i32, y: i32) function to determine if the sum of two integers is even.
    • Supports additional utility function sum_even(x: i32, y: i32) to calculate the sum of two integers.
  2. Floating-Point Arithmetic Operations

    • Addition: sum(x: f32, y: f32)
    • Subtraction: subtract(x: f32, y: f32)
    • Division: divide(x: f32, y: f32)
    • Multiplication: multiply(x: f32, y: f32)
    • Modulo: modulo(x: f32, y: f32)
  3. String Concatenation

    • Added say_name(first_name: &str, surname: &str) function to concatenate and display full names in a formatted message.

Sample Outputs

  • Even Check

    • Input: (5, 5) → Output: Is Even? false. The sum of the numbers, 5 and 5.
    • Input: (22, 21) → Output: Is Even? false. The sum of the numbers, 22 and 21.
  • Arithmetic Operations
    Example:

    The sum is 15.04
    The subtraction is 5.20
    The division is 1.44
    The multiplication is 159.81
    The modulo is 5.10
    
  • String Concatenation

    • Input: ("Eleazar", "Anonefdora") → Output: Hello, Eleazar Anonefdora

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant