C if statements ✔️

preview_player
Показать описание
C if else if else statements tutorial example explained

#C #if #statement
Рекомендации по теме
Комментарии
Автор

#include <stdio.h>

int main(){

int age;

printf("\nEnter your age: ");
scanf("%d", &age);

if(age >= 18){
printf("You are now signed up!");
}
else if(age == 0){
printf("You can't sign up! You were just born!");
}
else if(age < 0){
printf("You haven't been born yet!");
}
else{
printf("You are too young to sign up!");
}

return 0;
}

BroCodez
Автор

awesome content, I like that your keeping it short instead of saying its for beginners and then ending up explaining so much it ends up confusing us

leseditau
Автор

awesome content as always. keep it up, bro!

treebit
Автор

Am learning something it is simplified great work

reagan
Автор

if(age >= 18){
printf("You are now signed up!");
}
else{
printf("FBI open up!");
}

gambitjr
Автор

how about to make a statement where no 80+ years old alowed but started at 18 years old?

alriskynamikaze
Автор

whatever anything I do or know or knew

ryanalnaser
Автор

whatever anything before or after or anything

ryanalnaser
Автор

age<0 printf("you haven t been born yet!")
*baby who is 11 months old: am I joke to you?*
btw Bro tnx you helped me learn Python and C and I am still learning from you thanks

raneeks
Автор

here's some code that I made:

#include <stdio.h>

int main(){
float gradePointAverage;
printf("What is your GPA?\n");
scanf("%f", &gradePointAverage);
printf("\n");
if(gradePointAverage <= 1.8 && gradePointAverage >= 0){ // using && means that both statements must be true for the if statement to work.
printf("You need to get your life together.");
}
else if(gradePointAverage > 1.8 && gradePointAverage <= 3.0){
printf("Come on, you can do better than that.");
}
else if(gradePointAverage > 3.0 && gradePointAverage < 4.0){
printf("That's what I like to see!");
}
else if(gradePointAverage == 4.0){
printf("LET'S GO! YOU ARE PERFECT!");
}
else{
printf("That was not a valid GPA");
}
}

PSIwolf