5.4 KiB
5.4 KiB
<html lang="en">
<head>
</head>
Syntax Highlighting
Command Line Example
# ls -a
C Example
/* Adding Vectors * * A Program that adds vectors given the components. */ #include <stdio.h> #include <stdlib.h> int main() { float u1, u2, v1, u1, v2; /* Components */ /* Prompt user for variables */ printf("Enter the first component of vector 𝐮 (𝑢₁): "); scanf("%f", &u1); printf("Enter the second component of vector 𝐮 (𝑢₂): "); scanf("%f", &u2); printf("Enter the first component of vector 𝐯 (𝑣₁): "); scanf("%f", &v1); printf("Enter the second component of vector 𝐯 (𝑣₂): "); scanf("%f", &v2); /* Print the sum of the vectors */ printf("𝐮 + 𝐯 = <%.2f, %.2f>\n", u1 + v1, u2 + v2); return 0; }</html>