We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Day 1: Data Types
Day 1: Data Types
Sort by
recency
|
3909 Discussions
|
Please Login in order to post a comment
What is wrong? int secondI; float secondD; char s2[100];
scanf("%d", &secondI); scanf("%1f", &secondD); scanf("%s", s2);
printf("%d\n",i + secondI);
printf("%.1f\n", d + secondD);
printf("%s%s\n", s, s2);
import java.io.; import java.util.;
public class Solution {
}
Hello,
This is the backstory. When I 'Run Code', my "Sample Test case 0" is correct. When I "Submit Code", I get the wrong answer on "Test case 1".
i = 4 d = 4.0 s = 'HackerRank '
Declare second integer, double, and String variables.
i2 = 12 d2 = 4.0 s2 = 'is the best place to learn and practice coding!'
Read and save an integer, double, and String to your variables.
i3 = i + i2 d3 = d + d2 s3 = s + s2
Print the sum of both integer variables on a new line.
print(i3)
Print the sum of the double variables on a new line.
print(d3)
Concatenate and print the String variables on a new line
print(s3)
The 's' variable above should be printed first.
This is the solutuion in Python 3.
Declare second integer, double, and String variables.
Read and save an integer, double, and String to your variables.
se_int = int(input()) se_dou = float(input()) st_va = str(input(""))
Print the sum of both integer variables on a new line.
print(se_int+i)
Print the sum of the double variables on a new line.
print(se_dou + d)
Concatenate and print the String variables on a new line
print(s + st_va)
The 's' variable above should be printed first.
Has anyone solved this with c++. My output is matching with expected, Still test gets failed. Can anyone suggest what is issue.
int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */
int a; double b; string line; cin>>a; cin>>b; getline(cin>>ws, line);
}