🔥Finding it Damn Hard to Understand C Programming? Learn to code-the right way-with interactive lessons, quizzes & challenges. Build a strong programming base; it's IMPORTANT! Try Programiz PRO for Free: bit.ly/master-c-programming
You did an excellent job explaining the switch statement. I was and am still amazed at how easy you made this so understandable. Please continue teaching us. You have an absolute gift in how you explain these concepts. Thank you sooo much!
Programming Task: #include int main() { int number; printf("Enter a number: "); scanf("%d", &number); (number%2 == 0) ? printf("%d is an even number.", number) : printf("%d is an odd number.", number); return 0; }
#include int main() { int number; printf("Please enter the number:"); scanf("%d", &number); (number%2 == 0) ? printf("Number is an even number"): printf("Number is an odd number"); return 0; }
/* Can you create a program to check whether a number is odd or eve? > Use a ternary operator to check if the number is odd or even. > If number is odd, print "The number is Odd" > If number is even, print "The number is Even" */ #include int main() { int number; printf("Enter a number: "); scanf("%d", &number); // by using Ternary Operator (number % 2==0) ? printf("The number is Even") : printf("The number is Odd"); }
//Can you create a program to check whether a number is odd or even? //***Use a ternary operator to check if the number is odd or even //***If the number is odd print the number is odd //***If the number is even print the number is even #include int main() { int number; printf("Enter a number: "); scanf("%d", &number); (number % 2==0) ? printf("The number is Even.") : printf("The number is Odd."); return 0; }
i did the same thing and it worked but later on i made the ternary as int result=(number % 2==0) ? printf("The number is Even.") : printf("The number is Odd."); but when i print the resut itdoes say in the output whether the number is odd or even but it always adds 13 or 14 i dont understand why there is the "14 or 13 "
@@yasminehey3854 The program then checks whether 'num' is even or odd using the modulus operator %, and uses the ternary operator to print a message indicating whether the number is even or odd. However, the use of 'printf' in the ternary operator is not recommended because it returns the number of characters printed, not the value of the condition. As a result, the value of result will be 23 or 19, depending on the message printed. A better approach would be to use a separate variable to store the message, and then print that variable and the value of result separately. Here's an updated version of the program: #include int main() { int num = 78; char* message = (num % 2 == 0) ? "Your number is EVEN" : "Your number is ODD"; printf("%s ", message); int result = (num % 2 == 0) ? 0 : 1; printf("%d ", result); return 0; } This program first declares a char* variable named message, and assigns it a string value based on whether num is even or odd. It then uses printf to print message and a newline character. Finally, it declares an int variable named result, and assigns it a value of 0 if num is even or 1 if num is odd. It then uses printf to print result and a newline character.
One thing I can't understand bro. Why we used %d is even and %d is odd. If I used without %d it isn't working. But they didn't use %d in age calculator. Plzz explain bro
for the quiz, it opts C coz in the if-else statement the if part is evaluated to be true and hence gives 5 so the same principle applies Ternary:- (CONDITION) ? Statement1(Executed when True) : Statement2(Executed when False)
The correct answer is A, since the remainder of the modulus 5%2 is 1 making it not equal to 0. However, there is an exclamation mark before the parenthesis which means NEGATION or NOT, making it like this "1 is not equal to 0" or !1==0 in C language) which would be TRUE. That's why the answer is A. Inside if. If there is no negation or the symbol exclamation mark, the answer would be false which would be letter B. Inside else.
PROGRAMMING TASK: #include int main() { int num; printf("Enter number here: "); scanf("%d", &num); (num%2==0)?printf("The number is even."):printf("The number is odd."); return 0; } PROGRAMIZ QUIZ ANSWER: Option(B) 5>3?5:3;
The programming task: #include int main () { int number; printf("Enter a number: "); scanf("%d ", &number); (number % 2 == 0) ? printf("It is an even number ") : printf("It is an odd number "); return 0; } and B is the correct answer.
Mam, aapke liye chand taare tod ke laa sakta hoo.......coding challenge to keya chiz hai ? Ye lo answer.... #include #include int main() { int num; printf("Enter the age "); scanf("%d",&num); (num%2==0)?printf("The number is even"):printf("The number is odd"); return 0; } Aapka 2nd question ka answer hai option B.
I think the answer is B. Because the condition in the if...Else statement is if (5 > 3) instead of if the result = (5 > 3); for in that case the right answer would be C. Can anyone confirm?
#include int main (){ int num ; printf("Enter a number :"); scanf("%d", &num); if ( num % 2 == 0){ printf("The number is even."); } else if (num % 2 != 0){ printf("The number is odd."); }
program is #include int main() { int num; printf("enter the number: "); scanf("%d", &num); (num % 2 == 0) ? printf("number is even") : printf("number is odd");
Hello madam. Mind is displaying "number is even" when I haven't insert anything. int number; (number%2==0)? printf("number is even"): printf("number is odd");
why do I get an error when I try to do the operation with a "double" data type. I expected the integer to be converted to double since the double is greater than the int in the ranking
#include int main() { double num1=1; double num2=3,result; result=1+3; printf("enter the number: "); scanf("%d", &result); (result>=4)? printf("the number is even"):printf("the numer is odd"); return 0; }
programming task answer void main(){ int number; printf("enter number:"); scanf("%d", &number); (number %2==0)? printf("the number is even"): printf("the number is odd"); }
int main() { // Write C code here int num; printf("Enter number: "); scanf("%d", &num); if (num>0){ printf("The number %d is a positive number.", num); } else if (num
🔥Finding it Damn Hard to Understand C Programming?
Learn to code-the right way-with interactive lessons, quizzes & challenges. Build a strong programming base; it's IMPORTANT!
Try Programiz PRO for Free: bit.ly/master-c-programming
You did an excellent job explaining the switch statement. I was and am still amazed at how easy you made this so understandable. Please continue teaching us. You have an absolute gift in how you explain these concepts. Thank you sooo much!
hey buddy! How much part of C have you completed to date?
Programming Task:
#include
int main() {
int number;
printf("Enter a number: ");
scanf("%d", &number);
(number%2 == 0) ? printf("%d is an even number.", number) : printf("%d is an odd number.", number);
return 0;
}
wtf
#include
int main() {
int number;
printf("Please enter the number:");
scanf("%d", &number);
(number%2 == 0) ?
printf("Number is an even number"):
printf("Number is an odd number");
return 0;
}
/*
Can you create a program to check whether a number is odd or eve?
> Use a ternary operator to check if the number is odd or even.
> If number is odd, print "The number is Odd"
> If number is even, print "The number is Even"
*/
#include
int main() {
int number;
printf("Enter a number: ");
scanf("%d", &number);
// by using Ternary Operator
(number % 2==0) ? printf("The number is Even") : printf("The number is Odd");
}
thanks
did you try doing this operation with the "double" data type?
@@eazyj_c
Thank You!
Thanks
Your tutorials are so helpful. i learnt switch statement and im now learning tenrary operator. keep the great work up!
//Can you create a program to check whether a number is odd or even?
//***Use a ternary operator to check if the number is odd or even
//***If the number is odd print the number is odd
//***If the number is even print the number is even
#include
int main() {
int number;
printf("Enter a number: ");
scanf("%d", &number);
(number % 2==0) ? printf("The number is Even.") : printf("The number is Odd.");
return 0;
}
Thank you
i did the same thing and it worked but later on i made the ternary as
int result=(number % 2==0) ? printf("The number is Even.") : printf("The number is Odd.");
but when i print the resut
itdoes say in the output whether the number is odd or even but it always adds 13 or 14
i dont understand why there is the "14 or 13 "
@@yasminehey3854 The program then checks whether 'num' is even or odd using the modulus operator %, and uses the ternary operator to print a message indicating whether the number is even or odd.
However, the use of 'printf' in the ternary operator is not recommended because it returns the number of characters printed, not the value of the condition. As a result, the value of result will be 23 or 19, depending on the message printed.
A better approach would be to use a separate variable to store the message, and then print that variable and the value of result separately. Here's an updated version of the program:
#include
int main()
{
int num = 78;
char* message = (num % 2 == 0) ? "Your number is EVEN" : "Your number is ODD";
printf("%s
", message);
int result = (num % 2 == 0) ? 0 : 1;
printf("%d
", result);
return 0;
}
This program first declares a char* variable named message, and assigns it a string value based on whether num is even or odd. It then uses printf to print message and a newline character.
Finally, it declares an int variable named result, and assigns it a value of 0 if num is even or 1 if num is odd. It then uses printf to print result and a newline character.
in this part of your code,
" (number % 2==0) ? printf("The number is Even.") : printf("The number is Odd."); "
what does the % mean kindly🙏
@@sammuchina8189 % is could be DEVISION or as per our concept REMAINDER
I tried this in front of my teacher and even he doesn't know about this operator. Thank U❤️❤️❤️
Really useful content I really want to thank the teachers who are making the classes
Love it, explantion was clear and straightforward, however, I suggest you also talk about how to implement nested Ternary operators.
how are you doing after 5 months in programming?
Great explanation as always! Thank you for everyone to make this happen.
Answer is option c
Result=5>3 ? 5 : 3;
why its not B?
Thanks for providing this useful and & well content for us....
Code
#include
int main()
{
int a;
scanf("%d", &a);
(a %2 ==0) ?
printf("%d is even", a):
printf("%d is odd", a);
}
Ans for Question is C.
One thing I can't understand bro. Why we used %d is even and %d is odd. If I used without %d it isn't working. But they didn't use %d in age calculator. Plzz explain bro
why C?
Mam your explanation is very good and nice, can you make a tutorial videos on Data structures and algorithms in good explanation based on c language.
#include
int main();
{
Int number=2;
(number % 2 == 0) ? Printf("the number is even") : printf("the number is odd");
return 0 ;
}
Thanks for explaining this code simply
for the quiz, it opts C coz in the if-else statement the if part is evaluated to be true and hence gives 5 so the same principle applies Ternary:- (CONDITION) ? Statement1(Executed when True) : Statement2(Executed when False)
it is option c
Thankyou for explaining it so simply.. was waiting for your video ❤️
how are you doing after two years in programming?
Beautiful 🤩
Thank you for explaining it so well
the best C language tutorial👌👌👌
Thanks for providing " Good quality "content
By the way answer is option C
why c
i think option B is corrrect
@@shreyasy9164 yes boss b is ans
@@shreyasy9164 in the option B, if you change 5>3 to 3>5 , result will be 0 instead the result should be 3. So C is the answer.
b can also be the answer i checked it
ur way of teaching is exlent.....
VERY GREAT CONTENT
Thank you! The explanation is so useful!!!
Thank you for your happy programming for us🎉
It's going super good because of you explaining💞💕
The great teacher of c programing
Thank you! I didn't think it would be that easy to learn.
wonderful explaination, thank you!
(option c)...........cool and clear content by progrmizzzz.....plz keep going......
why c??????
@@shreyasy9164 5>3? Is a condition. After evaluating the condition, value will be assigned to result variable as either 5 or 3.
excellent teacher
I am going to write a test about this tomorrow🙄but I finally understant🥳
Ma'am thank you so much, I really appreciate ur work, and it really help me so much❤
Thank you🙏 mam. Your teaching quality is awesome👏
❤❤❤thank you for explaining it so easily❤❤❤
The correct answer is A, since the remainder of the modulus 5%2 is 1 making it not equal to 0. However, there is an exclamation mark before the parenthesis which means NEGATION or NOT, making it like this "1 is not equal to 0" or !1==0 in C language) which would be TRUE. That's why the answer is A. Inside if.
If there is no negation or the symbol exclamation mark, the answer would be false which would be letter B. Inside else.
Option c
Great video. Thank you so much
GREAT EXPLANATION!
PROGRAMMING TASK:
#include
int main() {
int num;
printf("Enter number here: ");
scanf("%d", &num);
(num%2==0)?printf("The number is even."):printf("The number is odd.");
return 0;
}
PROGRAMIZ QUIZ ANSWER: Option(B) 5>3?5:3;
The answer is option C)
The programming task:
#include
int main () {
int number;
printf("Enter a number: ");
scanf("%d ", &number);
(number % 2 == 0) ? printf("It is an even number
") : printf("It is an odd number
");
return 0;
}
and B is the correct answer.
Thank you, padma ❤
Thank you so much for such wonderful explanation!
how are you doing after 1 year in programming?
#include
int main () {
int number = 10;
(number % 2 == 0) ?
printf("this is even number "):
printf("This is odd number");
return 0;
}
Thanks 👍
i’m learning sm
was waiting for you mam ... please upload the next video soon
C is the right answer
C is the answer
Mam, aapke liye chand taare tod ke laa sakta hoo.......coding challenge to keya chiz hai ? Ye lo answer....
#include
#include
int main()
{
int num;
printf("Enter the age
");
scanf("%d",&num);
(num%2==0)?printf("The number is even"):printf("The number is odd");
return 0;
}
Aapka 2nd question ka answer hai option B.
Subscribed coz you guys are brilliant and have a great presentation style
Edit: Answer is C
Love it❤
B as we have to print Result = 5
but in C the value of just 5 is will be as output
Thank you very much!!
thanks a lot
its going good !!
The answer is option B.
Option B
Thanks ma'am
I think the answer is B. Because the condition in the if...Else statement is if (5 > 3) instead of if the result = (5 > 3); for in that case the right answer would be C. Can anyone confirm?
#include
int main (){
int num ;
printf("Enter a number :");
scanf("%d", &num);
if ( num % 2 == 0){
printf("The number is even.");
}
else if (num % 2 != 0){
printf("The number is odd.");
}
return 0;
}
it is coded in the common style.
Programming Task:
#include
#include
int main() {
int number;
printf("Enter Number: ");
scanf("%d", &number);
(number % 2==0) ? printf("EVEN #") : printf("ODD #");
return 0;
}
How is the flow chart drawn?
But is this advisable to use in an exam
6:21 answer is C C C
The real MVP
program is #include
int main() {
int num;
printf("enter the number: ");
scanf("%d", &num);
(num % 2 == 0) ? printf("number is even") :
printf("number is odd");
return 0;
}
good quality 😊
good work
C option for quiz mam
6:20 the answer is C
I have a question can I? create a program to integrate into a program like array and basic computer calculator etc. I hope you can answer thank you
Nice❤❤❤
Hello madam.
Mind is displaying "number is even" when I haven't insert anything.
int number;
(number%2==0)? printf("number is even"):
printf("number is odd");
Answer for the que?
Correct ans is B
B is the answer.
good
Option C : result = 5> 3 ? 5 : 3;
-----------------------------------------------------------
#include
int main()
{
int num;
printf("Enter A Number: ");
scanf("%d", &num);
(num % 2 == 0) ? printf("Even") : printf("Odd");
return 0;
}
why do I get an error when I try to do the operation with a "double" data type. I expected the integer to be converted to double since the double is greater than the int in the ranking
love it
Quizz answer: C
#include
int main(){
int a=0;
(a%2==0)?printf("the number is even"):printf("the number is odd");
return 0 ;
}
#include
int main() {
double num1=1;
double num2=3,result;
result=1+3;
printf("enter the number: ");
scanf("%d", &result);
(result>=4)? printf("the number is even"):printf("the numer is odd");
return 0;
}
I choose B
the correcr answer is C
Answer is :b
option:B
Answer is C
answer is c
answer i s C
option B.(5>3)? 5:3;
OptB
answer is "C"
Ans to quiz is B
Option C mam!!
WHY C ???
@@shreyasy9164 you solv the ternary operator ! you must ans in option c
#include
int main()
{
int num = 4;
(num%2==0)?
printf("This is an even number"):
printf("This is an odd number");
return 0;
}
Answer:a
programming task answer
void main(){
int number;
printf("enter number:");
scanf("%d", &number);
(number %2==0)? printf("the number is even"): printf("the number is odd");
}
dont forget to include the library header
Answer c
int main() {
// Write C code here
int num;
printf("Enter number: ");
scanf("%d", &num);
if (num>0){
printf("The number %d is a positive number.", num);
}
else if (num