## Problem:

Given two int values, return their sum. Unless the two values are the same, then return double their sum.

sumDouble(1, 2) → 3
sumDouble(3, 2) → 5
sumDouble(2, 2) → 8

## Solution:

public int sumDouble(int a, int b) {
if (a == b)
return 2 * (a + b);
else
return a + b;
}

#### 1 comment :

1. public int sumDouble(int a, int b) {
return (a == b)? 4 * a : a + b;
}
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "url": "http://www.javaproblems.com/2013/11/java-warmup-1-sumdouble-codingbat_7.html", "fetch_time": 1708480172000000000, "content_mime_type": "text/html", "warc_filename": "crawl-data/CC-MAIN-2024-10/segments/1707947473360.9/warc/CC-MAIN-20240221002544-20240221032544-00783.warc.gz", "warc_record_offset": 61241889, "warc_record_length": 14358, "token_count": 134, "char_count": 377, "score": 3.671875, "int_score": 4, "crawl": "CC-MAIN-2024-10", "snapshot_type": "latest", "language": "en", "language_score": 0.3701944649219513, "file_path": "/sailhome/yjruan/project/latent-lm/data/processed/finemath-4plus/finemath-4plus/train-00020-of-00064.parquet"}