Anonymous
what if one is casted to long long and other to double
Anonymous
But duplicating code is overwhelming
Anonymous
what if one is casted to long long and other to double
The result of whole expression will be long long
Anonymous
why?
Anonymous
Because there are C++ rules
Anonymous
Learn about implicit type casting in expressions
Anonymous
I don't know how it's called properly
Anonymous
What led you guess that the result will be long long and not double?
Anonymous
And because it's kinda obvious
Rashi
Hey ... Does anybody know how to debug RE(SIGFPE) error in C program ? It's a run time error
Rashi
#include<stdio.h> int main() { int t; long long n,k,apples_per_block1=0,apples_per_block2=0,apples_in_a_row2=0; scanf("%d",&t); while(t--){ scanf("%lli %lli",&n,&k); if(n>=1&&k!=0&&n%k==0){ apples_per_block1=n/k; if(k*k>n) printf("YES\n"); else{ apples_in_a_row2=k*k; apples_per_block2=k; if(n%apples_in_a_row2==0) printf("NO\n"); else printf("YES\n"); } } } return 0; }
Rashi
Any help ?
sambit
Anybody can give c tutorials
Czar
This is my code . It's working fine for one test case but giving run time error (re(Sigfpe)) for another
SIGFPE may occur due to - division by zero - modulo operation by zero - integer overflow SIFFPE is very easy to debug.
🎩
your code doesn't seem to be printing out anything
🎩
5 int t; 6 long long n, k, apples_per_block1 = 0, apples_per_block2 = 0, apples_in_a_row2 = 0; 7 scanf("%d", &t); -> 8 while (t--) 9 { 10 scanf("%lli %lli", &n, &k); 11 if (n >= 1 && k != 0 && n % k == 0) Target 0: (teleChannelDebug) stopped. (lldb) print t (int) $5 = 16438 right now when you initialzied t like that and minus off in while loop, it's taking a long time. 3rd point mentioned by @crxz0193 I think
Rashi
your code doesn't seem to be printing out anything
Yeah I just found out that . If n is a very very large number like 160000000000000000 and k a small number like 2 then modulus operator is not working
🎩
you gotta change your loop
Rashi
While loop ?
🎩
yep
Rashi
What's wrong in that ? And how can I correct it ?
Rashi
SIGFPE may occur due to - division by zero - modulo operation by zero - integer overflow SIFFPE is very easy to debug.
Thanks . I found those tips on Google too and now I know that third reason is the cause of this error in my case . But it's pretty difficult to debug it now
Anonymous
Get list of numbers in 2 arrays.find the identical integers from that 2 array and sort the final list in ascending order. Pls share the program
Anonymous
5 int t; 6 long long n, k, apples_per_block1 = 0, apples_per_block2 = 0, apples_in_a_row2 = 0; 7 scanf("%d", &t); -> 8 while (t--) 9 { 10 scanf("%lli %lli", &n, &k); 11 if (n >= 1 && k != 0 && n % k == 0) Target 0: (teleChannelDebug) stopped. (lldb) print t (int) $5 = 16438 right now when you initialzied t like that and minus off in while loop, it's taking a long time. 3rd point mentioned by @crxz0193 I think
main.cpp:1:1: error: expected unqualified-id before numeric constant 5 int t; ^ main.cpp:2:4: error: expected unqualified-id before numeric constant 6 long long n, k, apples_per_block1 = 0, apples_per_block2 = 0, apples_in_a_row2 = 0; ^ main.cpp:3:4: error: expected unqualified-id before numeric constant 7 scanf("%d", &t); ^ main.cpp:4:1: error: expected unqualified-id before ‘->’ token -> 8 while (t--) ^~
Dima
Lol o.O
Rashi
I have done it
Rashi
You can change long long int to unsigned lonnlong
Even that range wasn't much useful
Czar
Do you have testcase?
🎩
not sure what you're trying to achive but if your loop should always have a range. Initialize t as int. @CourageousTouch int t = 2147483648; while (t > 0) { /*code*/ t--; }
Czar
t is scanf prior to loop
🎩
oh
🎩
sorry i'm not too familiar with scanf. but is that a user input?
Czar
Yes, it's user input. Normally used in number of testcase to expect. Standard in many competitive programming website
Czar
Even that range wasn't much useful
Did you try with k=0. I see it can cause this issue
Pavel
Can you tell how does buffer works while printing anything?
I like your aspiration for details, but I can't answer this question. Pretty sure you can google it
Anonymous
I like your aspiration for details, but I can't answer this question. Pretty sure you can google it
I will google it. But, wanted to say that I find it difficult to read the documentation because it explains things that include details that I don't know at that point of time and hence I'm forced to check what that specific detail mean before learning the topic I wanted to understand.
Anonymous
Any recommended resources that teaches or manifest things in a smooth understandable way?
ابھی سنگھ
Hi
Dima
/warn We have a free pdf warn
Krishna@Kishan
Hello how to use vs code
Anonymous
Who Know about vb.net application
Mayur
Sorry
Anonymous
Anyone can help me in my assignment topic vb.net
Anonymous
Anonymous
because it is offtopic
I_Interface
Anyone can help me in my assignment topic vb.net
U can easy google it, comon man...
Anonymous
I just can't unstarstand what is so hard in following the rules
Anonymous
U can easy google it, comon man...
But not more information given
Anonymous
Anyone can help me in my assignment topic vb.net
/report 2nd and 3rd rules are violated
Dima
thanks
Anonymous
thanks
I think Rose deserves her own title, like you have one already
Dima
Yeah I suggested that
Dima
Tho I can’t see it for myself
Anonymous
Tho I can’t see it for myself
You're code warrior and Rose is beautiful banhammer :)
Anonymous
Hi guys I'm a new member in this group
Dima
I think I should be more specific tho.
ابھی سنگھ
Anyone can help me in c
Anonymous
What is that group for?
Anonymous
Can anyone suggest me a Light weight IDE for C++ in MACOS? I've been using Sublime Text + Terminal.
klimi
mac... xcode
Anonymous
emacs
yukk
Anonymous
xcode is heavy
Anonymous
too heavy
Dima
or CLion
Dima
CodeLite also.