LAB RECORD PROGRAM NO -1 Get link Facebook X Pinterest Email Other Apps November 27, 2022 1.Write a C Program to demontate the Ternary Operator. #include <stdio.h> #include<conio.h> void main() { int age; // take input from users printf("\nEnter 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"); getch(); } Get link Facebook X Pinterest Email Other Apps Comments
Explicit Conversion Program December 11, 2022 / / C program to demonstrate explicit type casting #include<stdio.h> int main() { double x = 1.2; // Explicit conversion from double to int int sum = ( int )x + 1; printf ( "sum = %d" , sum); return 0; } Read more
Comments
Post a Comment