determine the output of the following code in C

¡Supera tus tareas y exámenes ahora con Quizwiz!

15

#include <stdio.h> #include <conio.h> void main(){ clrscr(); int x = 5, y = 10, total; total = x + y; printf("The sum of %d and %d is %d",x,y,total); getch(); }

7th ex

#include <stdio.h> #include <conio.h> void main(){ clrscr(); int x; x = 10; printf("%d",x); getch(); }

8

#include <stdio.h> #include <conio.h> void main(){ clrscr(); int x; x = 65; printf("%c",x); //character value of 65 getch(); }

9

#include <stdio.h> #include <conio.h> void main(){ clrscr(); int x; x = 999; printf("%x",x); //hexadecimal value of 999 getch(); }

12

#include <stdio.h> #include <conio.h> void main(){ clrscr(); printf("Charac ters are printed as they w ere typed..."); getch(); }

13

#include <stdio.h> #include <conio.h> void main(){ clrscr(); printf("First line\n"); printf("Second\tline\n\n"); printf("Third\t\tline\n\n\n"); getch();

1

#include <stdio.h> #include <conio.h> //Constant #define #define TITLE_OF_GAME "THE BEST GAME EVER!" void main(){ clrscr(); //Constant variable const int number_of_lives = 3; const float rount_time = 3.00; printf("%s",TITLE_OF_GAME); printf("\nLives: %d",number_of_lives); printf("\nRound: %.2f",round_time); getch(); }

3rd ex

#include <stdio.h> #include <conio.h> void main(){ ;;;; ;;;;clrscr() ;;;; ;;;;int i = 0 ;;;; ;;;;printf("Value of variable i is %d",i) ;;;; ;;;;getch() ;;;; }

2nd ex

#include <stdio.h> #include <conio.h> void main(){ clrscr() ;int i = 0 ;printf("Value of variable i is %d",i) ;getch() ; }

10

#include <stdio.h> #include <conio.h> void main(){ clrscr(); double x; x = 100.556; printf("%lf \n",x); //default 6 decimal place printf("%.2lf",x); //2 decimal place getch(); }

6th ex

#include <stdio.h> #include <conio.h> void main(){ clrscr(); if(printf("Hello World!\n")){} printf("To the Moon."); getch(); }

18

#include <stdio.h> #include <conio.h> void main(){ clrscr(); int a, b, sum; printf("Enter the value for A:"); scanf("%d",&a); printf("Enter the value for B:"); scanf("%d",&b); sum = a + b; printf("The sum of A and B is %d",sum); getch(); }

4th ex

#include <stdio.h> #include <conio.h> void main(){ clrscr(); int i = 0; if(i==0); { printf("Hello World!\n"); } printf("To the Moon."); getch(); }

5th ex

#include <stdio.h> #include <conio.h> void main(){ clrscr(); int i = 0; if(i==0); { printf("Hello World!\n"); } printf("To the Moon."); getch(); }

14

#include <stdio.h> #include <conio.h> void main(){ clrscr(); int i = 5; char c = 'A'; float f = 125.213547; double d = 552.3918; printf("Value of i is %d\n",i); printf("Value of c is %c\n",c); printf("Value of f is %f\n",f); printf("Value of d is %lf" ,d); getch(); }

17

#include <stdio.h> #include <conio.h> void main(){ clrscr(); int i, output; printf("Enter a number: "); scanf("%d",&i); output = i * 2; printf("Result is %d",output); getch(); }

16

#include <stdio.h> #include <conio.h> void main(){ clrscr(); int i, output; scanf("%d",&i); output = i * 2; printf("Result is %d",output); getch(); }

19

#include <stdio.h> #include <conio.h> void main(){ clrscr(); int i; char c; float f; double d; scanf("%c%d%f%lf" ,&c,&i,&f,&d); printf("\nThe value of i is %c\n",c); printf("The value of c is %d\n",i); printf("The value of f is %f\n",f); printf("The value of d is %lf" ,d); getch(); }

1st ex.

#include <stdio.h> #include <conio.h> void main(){ clrscr(); int i; char c; printf("Enter a character: "); scanf("%c",&c); printf("Enter a number: "); scanf("%d",&i); printf("You have entered "); printf("%c & %d",c,i); getch(); }


Conjuntos de estudio relacionados

Chapter 13: Fluid and Electrolytes: Balance and Disturbance

View Set

MEDSURG Prepu: Chapter 44: Introduction to the Gastrointestinal System and Accessory Structures

View Set

Chapter 12: Emotions, Stress, and Health

View Set

S2 Physiology Unit 2 - Renal Physiology: RBF, GFR, AKI

View Set

Values, Ethics, and Advocacy - Chapter 5 - Module

View Set

Chem chapter 16 blackboard review

View Set