h
Can someone explain abt sorting technique in c?
Talula
Simplest one is bubble sort
Talula
VladV1V
Add blacklist for $ maybe...
VladV1V
And channels names etc
Dhruv
/get cbook
Rajesh
How to pass json object from c++ to java
Anonymous
folks, can anybody please tell me how to download the source code of book < sed and awk2>
Darkfire
what's the error in it..can anyone please tell
Eturnus
Yee
Eturnus
Check in if statement
Eturnus
Year%100!==0
Darkfire
sry
Eturnus
This expression is wrong
Darkfire
#include <stdio.h>
int main()
{
int x;
printf(" Enter any year value :");
scanf(" %d ",&x);
if( ( ( x % 4 == 0) && ( x % 100 != 0)) || ( x % 400 == 0))
{
printf("This year is definitely a leap year");
}
else
{
printf("This year is not at all a leap year");
}
return 0;
}
Eturnus
It must be != Or ==
Darkfire
check this...M jst getting asked to enter leap year
Darkfire
thn code doesnt run firther
Eturnus
Eturnus
There is one more error
Darkfire
Eturnus
X%100!=0
Eturnus
Use == instead of !=
Eturnus
X%100==0 like this
Darkfire
but I want to check leap year...
Eturnus
There are many error let me check
Darkfire
X%100!=0
nd even after this code is not completing
Eturnus
#include <stdio.h>
int main() {
int year;
printf("Enter a year: ");
scanf("%d", &year);
if (year % 400 == 0) {
printf("%d is a leap year.", year);
}
else if (year % 100 == 0) {
printf("%d is not a leap year.", year);
}
else if (year % 4 == 0) {
printf("%d is a leap year.", year);
}
else {
printf("%d is not a leap year.", year);
}
return 0;
}
Eturnus
Use this code
Eturnus
I separated all conditions
coal
that code seems wrong
coal
why is there a year % 400
coal
wouldn't it have been literally just year % 4 and else
coal
it is technically
coal
its the 500th leap year
coal
so the condition should be true
coal
with that code
Fola | Tau Project
Admin, are we allowed to post jobs in here?
Eturnus
It's leap year I guess
coal
Fola | Tau Project
Okay thanks
Darkfire
an year is a leap year...if it is divided bt 4 and not by 100
coal
but some people did it and never were banned or even warned
Darkfire
or it shud be divided by 400
Eturnus
Darkfire
exactly...I dont get any error...it just stops nd I hav to wait
coal
well
coal
maybe
coal
maybe
remove the unnecessary conditions
Darkfire
Darkfire
I want to knw wht's the error in my expression
Darkfire
#include <stdio.h>
int main()
{
int x;
printf(" Enter any year value :");
scanf("%i",&x);
if( ( ( x % 4 == 0) && ( x % 100 != 0)) || ( x % 400 == 0))
{
printf("This year is definitely a leap year");
}
else
{
printf("This year is not at all a leap year");
}
return 0;
}
Eturnus
Darkfire
Eturnus
In scanf you have put spaces in " %d "
Eturnus
Remove spaces inside double quote
Eturnus
This is only error 😅
Eturnus
Eturnus
Eturnus
Eturnus
I just tried
coal
#include <stdio.h>
int main()
{
int x;
printf("Enter any %cd :", 37);
scanf(" %d",&x);
printf("Got %d", x);
return 0;
}
coal
I just tried
me too and surprisingly it doesn't affect
coal
it ignores whitespace when reading numeric data
coal
unlike with characters or strings
Vlad
Vlad
Btw you can use %%
Vlad
If you want to escape a %
coal
37 is the ascii code for %, because %d would have been misinterpreted for a format code
coal
coal
did it quickly
Vlad
Also there's a cheat with
printf("%s", "%%%%%%%");
coal
lol
coal
looks like JavaScript's !!!!!!!!!!!!!!!! "operator"
ببب ب
ببب ب
(if byte wasn't a library type)
Vlad
Imo void* pointer is useless if char* exists