Anonymous
😶
Anonymous
hi everyone
Anonymous
Guys what changes i required to do in my i/p if i want my o/p as 5678. 678. 78. 8
Dream it
/#include <stdio.h> int main() { printf("%%%%\n"); return 0; }
Dream it
guys what is output of this program ? and why
Dream it
output : %%
Dream it
how ?
Anonymous
im new
Dream it
I didnt get its logic
Anonymous
i dont know
Anonymous
but it seems uncommon,why you want to know?
Dream it
when we print %%%% , then why ouput is only %% ?
Dream it
can you explain
olli
cplusplus.com says A % followed by another % character will write a single % to the stream.
olli
This makes perfect sense, since % has a special meaning in the format specifier. To actually print the symbol and not treat it as "format specifier" you need to escape it.
olli
This is basically the same when you want to print a backslash (\). Since the backslash is part of white space characters such as line feed or tabs, you need to escape it.
Anonymous
oh,im almost understand ,but what does % mean in C ?
Anonymous
Its means modulo
olli
oh,im almost understand ,but what does % mean in C ?
Have you printed a number using printf before?
Anonymous
Ie when u divide any number and the remainder you get is answer
Anonymous
yes
olli
yes
How did you do it?
Anonymous
How did you do it?
just printf( "%d",number)
olli
Exactly!. But now imagine you actually want to print "%d", how would the printf function Know what you want?
Anonymous
Wdyt about Google code jam vs Facebook hacker cup?
olli
i dont know ,sorry
No worries - kind a rhetorical question Since "%d" means an integer, you need to write "%%d". The first % starts a "format", but since you don't want to have one you tell it just to write the symbol "%" by adding a second "%". (Similar to \\ printing \)
Anonymous
Hi guys
Anonymous
hi
Anonymous
Anonymous
the only problem is when I type anything else than 'y' or 'n' and longer than single word at the end (when it asks me go again y/n ?) it gives twice 'your answer is not correct' it because of the type of 'answer' is char and I cant change it to string when I change it gives an error : need your help guys
Sid Sun
/#include <stdio.h> int main() { printf("%%%%\n"); return 0; }
Oh; ez. As you know % is used for giving it parameters like %d %f etc. Consider you want to print % to the output, in C to do this , you type %% this puts one % to output
Shivam
+ is bae
Anonymous
Hey, I have a problem with two functions in C. Is it allowed to send code here or better use pastebin?
Anonymous
They aren't that huge
Sid Sun
Anonymous
hello all
Anonymous
can i ask something?
Anonymous
im so bad at C
Anonymous
how to master the language c
Anonymous
I am in trouble
Sid Sun
how to master the language c
What I like to do is: do projects on what I'm working on
Sid Sun
I do basics of technology I'm interested in
Sid Sun
Then I think of any project that gets be interested and do it using that technology
Sid Sun
Some are absurd
Sid Sun
But I like to work on them because I do things to learn :)
Sid Sun
But I am in no way master
Anonymous
But I like to work on them because I do things to learn :)
can you teach me, because I want to be serious about learning to master C, because this is very important for my department
Sid Sun
What are your problems, what difficulties you face, etc.
Anonymous
okey, first i dont know how to use looping
Anonymous
this makes me dizzy
Sid Sun
okey, first i dont know how to use looping
Okay, Do you know why loops are used?
Anonymous
Okay, Do you know why loops are used?
i dont know,what are its main uses?
Sid Sun
i dont know,what are its main uses?
Okay. Loops are used when we need to do something in a pattern or do something over and over again. For example: Print hello 5 times. You can do it using printf 5 times but that is not ideal since that way you are doing hardcode, you can instead use loops and print 5 times or, as many times as the user wants without touching your code!
Ariana
English
Anonymous
can anyone recommend some books to read for us new?
Sid Sun
I know I'm starting to understand, but what code is used if it's not 'printf'?
we can use for loop to solve that problem like this: for (i=0;i<5;i++) { printf("hello"); }
Ariana
#cppbook
Anonymous
wow,thank you!
Sid Sun
do we add (int i;) to for (i = 0; i <5; i ++)?
Yes, We obviously need to declare the variable we are going to use
Sid Sun
What this does: set the variable 'i' as 0 Then check if i is less than 5 (it is 0, so yes) It runs printf and prints 'hello' it increases the value of 'i' by 1 Then it checks again and if condition is (note that i is set as 0 only the first time, after that it is not executed) true, it prints 'hello' It increases it by 1 again
Sid Sun
but do you use software / applications for coding like C?
Yeah, I use cLion and gcc for compilation
Anonymous
Yeah, I use cLion and gcc for compilation
what is clion ,it an Android app?
Sid Sun
Not on Android, obviously
Sid Sun
Windows, Linux, macOS
Anonymous
i think coding on Android is super relax
Anonymous
and comfortable
Anonymous
Lol no
Dima
It’s super silly