Uploaded March 2025 | Updated September 2026, 1 week ago
#coding #programming #cprogramming
float price = 10.00;
bool isStudent = true; // 10% discount
bool isSenior = true; // 20% discount
// student = $9
// senior = $8
// student + senior = $7
if(isStudent){
if(isSenior){
printf("You get a student discount of 10%\n");
printf("You get a senior discount of 20%\n");
price *= 0.7;
}
else{
printf("You get a student discount of 10%\n");
price *= 0.9;
}
}
else{
if(isSenior){
printf("You get a senior discount of 20%\n");
price *= 0.8;
}
}
printf("The price of a ticket is: $%.2f\n", price);
return 0;
#coding #programming #cprogramming
float price = 10.00;
bool isStudent = true; // 10% discount
bool isSenior = true; // 20% discount
// student = $9
// senior = $8
// student + senior = $7
if(isStudent){
if(isSenior){
printf("You get a student discount of 10%\n");
printf("You get a senior discount of 20%\n");
price *= 0.7;
}
else{
printf("You get a student discount of 10%\n");
price *= 0.9;
}
}
else{
if(isSenior){
printf("You get a senior discount of 20%\n");
price *= 0.8;
}
}
printf("The price of a ticket is: $%.2f\n", price);
return 0;

![Learn how to enter user input in C! โจ๏ธ
#coding #programming #cprogramming
00:00:00 VSCode setup
00:01:55 declaring variables
00:02:57 undefined behavior
00:06:31 scanf
00:09:47 input buffer
00:10:47 scanf w/ strings
00:12:16 fgets
00:13:20 getchar()
00:14:05 removing n from a string
int age = 0;
float gpa = 0.0f;
char grade = 0;
char name[50] = ;
printf(Enter your age: );
scanf(%d, &age);
printf(Enter your gpa: );
scanf(%f, &gpa);
printf(Enter your grade: );
scanf( %c, &grade); // The space before %c is necessary to consume any leftover n.
getchar(); // clears n from input buffer
printf(Enter your full name: );
fgets(name, sizeof(name), stdin);
name[strlen(name) - 1] = 0; //changes last char from n to 0
printf(%sn, name);
printf(%dn, age);
printf(%.2fn, gpa);
printf(%cn, grade);
return 0; Learn how to enter user input in C! โจ๏ธ](https://i.ytimg.com/vi/rknoBwLDzAI/mqdefault.jpg)






![Learn the Java ternary operator in 5 minutes! โ
#java #javatutorial #javacourse
public class Main {
public static void main(String[] args) {
// ternary operator ? = Return 1 of 2 values if a condition is true
// variable = (condition) ? IfTrue : IfFalse;
int number = 10;
String evenOrOdd = (number % 2 0) ? EVEN : ODD;
}
} Learn the Java ternary operator in 5 minutes! โ](https://i.ytimg.com/vi/t2PcC-FYFmI/mqdefault.jpg)
![Learn Java multithreading in 8 minutes! ๐งถ
#java #javatutorial #javacourse
public class Main {
public static void main(String[] args) {
// Multithreading = Enables a program to run multiple threads concurrently
// (Thread = A set of instructions that run independently)
// Useful for background tasks or time-consuming operations
Thread thread1 = new Thread(new MyRunnable(PING));
Thread thread2 = new Thread(new MyRunnable(PONG));
System.out.println(GAME START!);
thread1.start();
thread2.start();
try {
thread1.join();
thread2.join();
}
catch (InterruptedException e) {
System.out.println(Main thread was interrupted);
}
System.out.println(GAME OVER!);
}
} Learn Java multithreading in 8 minutes! ๐งถ](https://i.ytimg.com/vi/taI7G6U29L8/mqdefault.jpg)
