10,307 views
0 votes
0 votes

Q.

Input Format

Input consists of the following space-separated values: intlongcharfloat, and double, respectively.

Output Format

Print each element on a new line in the same order it was received as input. Note that the floating point value should be correct up to 3 decimal places and the double to 9 decimal places.

Sample Input

3 12345678912345 a 334.23 14049.30493

Sample Output

3
12345678912345
a
334.230
14049.304930000

My Code:---->

#include <iostream>
#include <cstdio>
#include<iomanip>
using namespace std;

int main() {
    // Complete the code.
    int i; long l; char c; float f;  double d;
    cin>>i>>l>>c>>f>>d;
    cout<<"\n"<<i<<"\n"<<l<<"\n"<<c<<"\n"<<f<<"\n"<<d;
    return 0;
}

Output:--->

Your code did not pass this test case.

Input (stdin)

3 12345678912345 a 334.23 14049.30493

Your Output (stdout)


3
12345678912345
a
334.23
14049.3

Expected Output

3
12345678912345
a
334.230
14049.304930000

Compiler Message

Wrong Answer

Where am i wrong?

1 Answer

0 votes
0 votes
Use the following code so u wil; complete all test cases.

#include <iostream>
#include <cstdio>
using namespace std;

int main() {
    // Complete the code.
    int a;
    long b;
    char c;
    float d;
    double e;
    scanf("%d %ld %c %f %lf",&a,&b,&c,&d,&e);
    printf("%d",a);
    printf("\n%ld",b);
    printf("\n%c",c);
    printf("\n%.3f",d);
    printf("\n%.10lf",e);
    return 0;
}

Related questions

569
views
3 answers
0 votes
AIkiran01 asked Jun 5, 2017
569 views
int A(int m,int n){ if(!m) return n+1; if(!n) return A(m-1,1); return A(m-1,A(m,n-1));}int main(){ printf("A(1,2)=%d",A(1,2)); }what will be the output and how?
6.0k
views
3 answers
0 votes
Nitesh Choudhary asked Apr 16, 2017
5,962 views
4. Which of the following is not a valid variable name declaration and why?a) float PI = 3.14;b) double PI = 3.14;c) int PI = 3.14;d) #define PI 3.14
3.3k
views
1 answers
2 votes
anonymous asked Apr 16, 2017
3,334 views
4. Which of the following is not a valid variable name declaration and why?a) float PI = 3.14;b) double PI = 3.14;c) int PI = 3.14;d) #define PI 3.14
789
views
1 answers
1 votes
Naveen Kumar 3 asked Jul 29, 2017
789 views
main ( ){int a = 2, b, c;a* = b = c = 4;a = b = c;printf (“%d”, a);a = = (b = c);printf (“%d”, a);}What will be the output?Not able to understand !!