Anonymous
Anonymous
And it will compile
Jhagrut
And it will compile
I did it mam and it compiled
I also had done mistake in variable so I changed them to convenient ones
but
1 why was it showing error pointing out the precision
2 now that it has successfully compiled
It is showing wrong answer
Jhagrut
#include<stdio.h>
#include<stdlib.h>
int main()
{
int w;
float ab,c;
//printf("write your withdraw amount");
scanf("%d\n", &w);
//printf("write your bank balance");
scanf("%.2f\n", &ab); //.2f is for points of precision
c=w+0.5;
if (ab>c && w%5==0)
{
printf("%.2f\n", ((ab-w)-0.5) ) ; //new balance on successful transaction
}
else{
printf("%.2f\n", ab) ;
}
return 0;
}
C.
C.
C.
Jhagrut
This answer has been accepted by the program given by some other user
Jhagrut
C.
In the printfs you put %.2f
C.
Just not in the scanf
C.
Jhagrut
i'm having issue to Concatenate the strings
vps Pro
Hey gays .l am begging to learn C , and i need tiny ide to compile code (*.exe) . thanks
C.
C.
Put your code in pastebin.
vps Pro
Dima
Jhagrut
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main() {
int i = 4;
double d = 4.0;
char s[] = "HackerRank ";
int j;
float k;
char l[100];
scanf("%d%f", &j,&k);
for (int m=0;m<100;m++)
scanf("%c\n", &l[i]);
printf("%d\n", i+j);
// Print the sum of the double variables on a new line.
printf("%.1f\n", d+k);
// Concatenate and print the String variables on a new line
// The 's' variable above should be printed first.
printf("%c", s);
for(int o=0;o<100;o++)
printf("%c", l[o]);
return 0;
}
Jhagrut
Sample Input
12
4.0
is the best place to learn and practice coding!
Sample Output
16
8.0
HackerRank is the best place to learn and practice coding!
C.
Jhagrut
printf("%s", s);
for(int o=0;o<100;o++)
printf("%c", l[o]);
C.
Jhagrut
sir if i remove this for loop how to print the second string to be input by the stdin
C.
With %s
Jhagrut
printf("%s", s);
printf("%s", l);
return 0;
Jhagrut
Your Output (stdout)
HackerRank
Expected Output
HackerRank is the best place to learn and practice coding!
Jhagrut
sir can u pls tell me how to correct this
i have to attach user input of character string
Jhagrut
scanf("%s", l);
printf("%s", s);
printf("%s", l);
return 0;
Your Output (stdout)
HackerRank is
expected
HackerRank is the best place to learn and practice coding!
Jhagrut
here i removed the first loop and tried to run
but it is printing only 1 word not the sentence
C.
Jhagrut
for (int m=0;m<100;m++)
{ getchar();
ch=getchar();
l[i]=ch;
}
printf("%s", s);
for (int n=0;n<100;n++)
printf("%c", l[n]);
Jhagrut
Jhagrut
tried getchar but got this as output
Jhagrut
pls help me out
Anonymous
https://pastebin.com/wFLtG0XT
Anonymous
why does it start a new line in this code, when i print out the data inputed in fgets
Jarvis .....
Hello world
Anonymous
std::cout << “Sup” << std::endl;
Ибраги́м
Anonymous
sorry no endl
Anonymous
\n
Ибраги́м
Ибраги́м
NOT >>
Anonymous
cin
C.
cin
Cin >>
Cout <<
Anonymous
sorry
Anonymous
lol
Anonymous
all fixed now
C.
Lol
Anonymous
been a while
C.
write(1, "Heyo!/n", 6);
Anonymous
C.
Ибраги́м
Anonymous
not equal ?
Anonymous
when using fgets in C, and then using printf, how do you get it to not start a new line
C.
C.
True
Anonymous
C.
Anonymous
ok ...
C.
Look at the quotations
C.
C.
C.
After receiving the input you can either truncate it (awful choice. Never do this)
Or you can find the character and change it to "end of the string" character ('/0').
Anonymous
Anonymous
i just updated telegram , didnt realize they have a dark mode
I_Interface
Anonymous
\n
did you see the pastebin