You are on page 1of 3

TUTORIAL 1

DTT 201
SEMESTER JUNE 2016
Write a program based on the example output shown below. Answer all the
questions.

1.
************************
HELLO WORLD !!!
************************

#include<stdio.h>
void main(void)
{
printf ("***************\n");
printf ("
\n");
printf (" HELLO WORLD!!!\n");
printf ("
\n");
printf ("***************\n");
return;
}

2. Age Calculator
Enter your birth year: 1985
Enter the current year: 2013
Your age for this year is 28 years old.

#include<stdio.h>
void main(void)
{
int age,current_year,birth_year;
printf ("enter yput birth year:");
scanf("%d",& birth_year);
printf ("enter your current year:");
scanf ("%d",&current_year);
age = current_year-birth_year;
printf ("your age for this year is %dyears old",age);
return;
}

3. Simple Cashier System

Item Price : RM6.50


Item Quantity: 2
Total amount is RM13.00

#include<stdio.h>
void main(void)
{
float total_amount,item_price;
printf ("enter the item price: RM ");
scanf ("%f",&item_price);
int quantity;
printf ("enter your quantity:");
scanf ("%d",&quantity);
total_amount = item_price*quantity;
printf("total amount is %.2f",total_amount);

You might also like