Vlad
Shouldn't it be strictly less?
Aakash
Btw why <=?
No issues! You may take it as <. I was doing something else.. forgot to correct it; ..
Ari
hi
Arpit
how to print any word without using semicolon ;
Arpit
yes how to print hello c or any other word without semi colon ;
Arpit
because when we use printf it ended with semicolon
Apk
Do you mean the ; at the end of statement?
Arpit
so is there any way to writ a program of printing hello world without using a single semicolon
Apk
Also why would you want to remove it?
Anonymous.
This is the way how you can print hello without semicolon in c
Anonymous.
If(printf("hello"))
Arpit
Also why would you want to remove it?
I searched some tricky c programs so from net there I got this program ,so I thought ask from others
Arpit
I m 1st year CSE students
Arpit
Can we use gets instead of scanf
Arpit
Int a; Printf("enter the value of a"); Gets(a);
Ange
Scanf is the best solution if I'm not mistaken
Ange
Gets will effects for the efficiency of the program
Ange
I need to arrange nodes of a linked list according to the alphabetical order can anyone guide me Eg input Abc --Bac--Cba this works 100% correctly but if I use a different format which mean example Input 1 = elephant grass Input 2 = parrot fruit Input 3 = rabbit This won't arrange Cording to the alphabetical order the problem is some are having two words Can some one help me
Igor🇺🇦
Can we use gets instead of scanf
gets shouldn't ever be used. It's removed from C++ because it's dangerous. scanf is not much safer either. Prefer using fgets because it requires you to enter buffer size. This option is safer and acts like scanf. if (fgets(line, sizeof(line), stdin)) { if (1 == sscanf(line, "%d", &i)) { /* i can be safely used */ } } Taken from https://stackoverflow.com/questions/9278226/which-is-the-best-way-to-get-input-from-user-in-c
Ange
Thanks a lot sure!
Arpit
How to use geeks for geeks site
Arpit
To become good in c language
K M GANDHI
how to read array elements through user input without asking user to enter its size
olli
how to read array elements through user input without asking user to enter its size
you either - use a linked list - use std::vector (if you use C++) - implement a "resizeable vector-like array" if you have to use C
ברני
Hello again, didn't touch C for a month and now came back to the same easy question that I don't understand why it dosn't work...I remember Olli helped me with this but I forgot what was the answer...(Wasnt on telegram alot..) on C, dividing by minus only.. why it dosn't work?
ברני
https://onlinegdb.com/r1-pvOd6D
ברני
I tried all return options.. on while loop I tried also num1>=num2 and also true (1) and still not working...
olli
Hello again, didn't touch C for a month and now came back to the same easy question that I don't understand why it dosn't work...I remember Olli helped me with this but I forgot what was the answer...(Wasnt on telegram alot..) on C, dividing by minus only.. why it dosn't work?
There are a couple things wrong with this implementation, e.g. while (num2 != 0) ^^^^ { num3 = num1 - num2; ^^^^ cnt++; printf ("%d", num3); } You check num2 for being not 0 but never change it, you reassign the same value to num3 over and over again, since neither num1 nor num2 change in your loop body. In general, checking for 0 is not correct because despite not being zero, 2 cannot be divided by 5.
ברני
while (num1 >= num2) { num1 -= num2; ++cnt; }
And then num3 =num1? Or just return num1?
olli
And then num3 =num1? Or just return num1?
you should return 0; from main if your execution was successful. once main returns your logic ends and you return control back to your operating system which might perform different operations based on the value returned from main. You don't need num3 in your application. in case you want it, because you don't want to change num1 you can assign num1 to num3 before the loop, e.g. num3 = num1; while (num3 >= num2) { num3 -= num2; ++cnt; }
Roy
Hi, how fix bug "unknown type "int" from intrin.h"? When i use clang, he show me 418 error's about unknown type. Project compiled fine, only show errors
Oda Waves
Hey , Is there anyone work in plc programming
Arpit
Not working 🙄
Suka
Hey , Is there anyone work in plc programming
iam. but this is out of topic here.
Arpit
I have written simple program
Arpit
If(printf("hell"))
yasin
1+x¹+x²+x³.........x^n How can i solve this using functions in the C program?
yasin
Help
yasin
Hi
yasin
İ am new to this, O guess i can't do it
ברני
ברני
İ am new to this, O guess i can't do it
So learn, these alot of lessons on Google and YouTube
ברני
yasin
🤨
We haven't worked yet
yasin
Something like this exam
ברני
We haven't worked yet
You can't do complicated math with out include <math.h> if I'm not wrong..
Jaen
You should compile "with gcc main.c -o main -lm"
Igor🇺🇦
You can't do complicated math with out include <math.h> if I'm not wrong..
Calculating 1+x+x^2... is not hard assuming x is given by user. That's like introduction to loops or recursion level and it's solvable without any of those too.
Igor🇺🇦
He wants to do powers.. You need math.h for that no?
Power is just x*x*x.... We're taking about natural numbers only. No need for any special function
Apk
using power function for each term of the summation won't be efficient I guess
Igor🇺🇦
using power function for each term of the summation won't be efficient I guess
It's the simplest geometric series that has a closed form. You just need to calculate power once.
Igor🇺🇦
But he did powers there
That's the same expression. X^n. N is natural number.
Apk
It's the simplest geometric series that has a closed form. You just need to calculate power once.
Yes I mean using a function there will result in unnecessary calculations.
Igor🇺🇦
If its that easy, do it bro 😅
That's your homework. There is nothing tricky here.
Igor🇺🇦
Yes I mean using a function there will result in unnecessary calculations.
Closed formula for this series (1-x^n)/(1-x) for finite n.
dj
That's your homework. There is nothing tricky here.
so there is nothing like 2**3 in c/c++ ?
Igor🇺🇦
so there is nothing like 2**3 in c/c++ ?
You have https://en.cppreference.com/w/cpp/numeric/math/pow
Igor🇺🇦
Okay....I didn't know the formula
https://en.m.wikipedia.org/wiki/Geometric_progression#Geometric_series
Arpit
Yes ,right in the main()