Search
 
SCRIPT & CODE EXAMPLE
 

C

c programming trinary if

testCondition ? expression1 : expression 2;
Comment

c programming trinary if

#include <stdio.h>

int main() {
  int age;

  // take input from users
  printf("Enter your age: ");
  scanf("%d", &age);

  // ternary operator to find if a person can vote or not
  (age >= 18) ? printf("You can vote") : printf("You cannot vote");

  return 0;
}
Comment

PREVIOUS NEXT
Code Example
C :: gcc comand for running hello.c 
C :: c printf float value 
C :: vbl share price 
C :: formula to find the area of a trapezium in c 
C :: vs code turn off formatter 
C :: how to write a hello world program in c 
C :: matrix of string in c 
C :: write to console c 
C :: how to do add to an integrr in c 
C :: visual studio code 
Dart :: dart remove last character from string 
Dart :: rounded raisedbutton in flutter 
Dart :: flutter clear navigation stack 
Dart :: Dart integer User input 
Dart :: round to decimal places dart 
Dart :: loop in dart 
Dart :: constrainedbox flutter 
Dart :: Flutter - BoxShadow Widget 
Dart :: dart find element in list 
Dart :: Flutter turn string to int 
Dart :: text should come below if space not available row flutter 
Dart :: flutter listview space between items 
Dart :: dartpad missing browser localstorage 
Dart :: string to datetime flutter 
Dart :: space around in flutter 
Dart :: after build flutter 
Dart :: check if string contain number dart flutter 
Dart :: flutter float right 
Dart :: android studio emulator blue screen windows 10 
Dart :: flutter remove dropdown shadow appbar 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =