Professional Documents
Culture Documents
T1-Cs101 - Introduction To Computing 1 2014
T1-Cs101 - Introduction To Computing 1 2014
T1-Cs101 - Introduction To Computing 1 2014
B. SIMPLE IF
1. A Program that will run if the value is lesser than 20
CODE
#include<stdio.h>//header
#include<conio.h>//header
Main()//main function
{//terminal
Int a;//variable
Clrscr();//clear screen
Printf(input the value:__);//displays a string
Scanf(%d,&a);//scan formatted
If (a<20)//sequence statement
{//terminal
Printf(Number %d is less than 5,a);//displays a string
}//terminal
Getch();//support the conio
OUTPUT
Input the value: 10
Number 10 is less than 20
2. Program to Read Three Numbers and Print the Biggest Of Given Three Numbers
CODE
# include <stdio.h>//header
# include <conio.h>//header
main( )//main function
{//terminal
int a,b,c,big=0;//variable
clrscr( );//clear screen
printf(ENTER VALUE FOR A:);//displays a string
scanf(%d,&a);//scan formatted
printf(ENTER VALUE FOR B:);//displays a string
scanf(%d,&b);//scan formatted
print(ENTER VALUE FOR C:);//displays a string
scanf(%d,&c);//scan formatted
if (a>big)//sequence statement
big=a ;
if(b>big)//sequence statements
big=b;
if (c>big)//sequence statements
big=c;
printf (BIGGEST OF ABOVE GIVEN THREE NUMBER IS %d,big)//displays a
string
getch( );//sipport conio
Shermaine May F. Apigo
}//terminal
OUTPUT
ENTER VALUE FOR A: 2
ENTER VALUE FOR B: 4
ENTER VALUE FOR C: 6
BIGGEST OF ABOVE GIVEN THREE NUMBER IS: 6
OUTPUT
Enter a number:5
Single digit
OUTPUT 2
Shermaine May F. Apigo
Enter a number:12
Not single digit
4. To check whether the character is vowel
CODE
#include<stdio.h>//header
#include<conio.h>//header
main()//main function
{//terminal
char x;//variable for character
clrscr();//clear screen
printf(Enter a letter:);//displays a string
scanf(%c,&x);//scan formatted
if(x==a || x==A || x==e || x==E || x==i || x==I
|| x==o || x==O || x==u || x==U)//sequence statement
printf(It is Vowel);//displays string
getch();//support a conio
}//terminal
OUTPUT
Enter a letter: u
It is Vowel