Adak
trust me im serious ... if i couldnt find how to do it i will loss 20%

Swarvy

I didn't writ anything at all coz in the whole semester we didn't study anything like that

and the lecturer said we will not find the way in the notes so we have to search in the internet

I will show u what did we study

examples:

1
Code:
#include<stdio.h>
main ( )
{
int age=44,workexp=5;
float salary=1800.00;
char gender='M';

printf("Ali's age is %d\n",age);
printf("He has %d years working experience\n",workexp);
printf("He is earning RM %.2f this month\n",salary);
printf("His gender code is %c",gender);

return 0;
}
2
Code:
#include<stdio.h>
main()
{
int x=-4443;
float y=554.21;
char c='M';

printf("The value of integer variable x is %d",x);
printf("\nThe value of float variable y is %f",y);
printf("\nThe value of character variable c is %c",c);
return 0;
}
3
Code:
#include<stdio.h>
main()
{
int x=-4443;
float y=554.21;


printf("x is %d and y is %f",x,y);
printf("\n==> c is M Thank you");

return 0;
}
4
Code:
#include<stdio.h>
main()
{
char n[10];
char p[20];
char m[11];
int s;
float g;

printf("Enter your name           :");
scanf("%s",&n);
printf("Enter your matric no      :");
scanf("%s",&m);
printf("Enter your semester       :");
scanf("%d",s);
printf("Enter your program        :");
scanf("%s",&p);
printf("\nEnter your subject 1 grade point      :");
printf("\nEnter your subject 1 credit           :");
printf("\nEnter your subject 2 grade point      :");
printf("\nEnter your subject 2 credit           :");
printf("\nEnter your subject 3 grade point      :");
printf("\nEnter your subject 3 credit           :");
printf("\nEnter your subject 4 grade point      :");
printf("\nEnter your subject 4 credit           :");
printf("\nEnter your subject 5 grade point      :");
printf("\nEnter your subject 5 credit           :");
printf("\nEnter your subject 6 grade point      :");
printf("\nEnter your subject 6 credit           :");
printf("\nEnter your subject 7 grade point      :");
printf("\nEnter your subject 7 credit           :");

printf("\n**************************************************");
printf("\n\t\tExam Result Slip");
printf("\n\t\t    Semester");
printf("\n\t  Diploma In Civil Engineering");
printf("\n--------------------------------------------------");
printf("\nA");
printf("\n--------------------------------------------------");
printf("\nTotal credits   :");
printf("\nGPA             :");
printf("\n**************************************************");


return 0;
}
5
Code:
#include<stdio.h>
main()
{
float a;
printf("Monthly Salary    :RM");
scanf("%f",&a);
printf("Your Bonus for Year 2005 is RM%.2f",0.75*a);
return 0;
}
6
Code:
#include<stdio.h>
main()
{
int s;
printf("Enter a number:  ");
scanf("%d",&s);
printf("\n1 x %d = %d\n",s,1*s);
printf("2 x %d = %d\n",s,2*s);
printf("3 x %d = %d\n",s,3*s);
printf("4 x %d = %d\n",s,4*s);
printf("5 x %d = %d\n",s,5*s);
printf("6 x %d = %d\n",s,6*s);
printf("7 x %d = %d\n",s,7*s);
printf("8 x %d = %d\n",s,8*s);
printf("9 x %d = %d\n",s,9*s);
printf("10 x %d = %d\n",s,10*s);
printf("11 x %d = %d\n",s,11*s);
printf("12 x %d = %d",s,12*s);
return 0;
}
7
Code:
#include<stdio.h>
main()
{
float a,b;
printf("**Kentucky Restaurant**");
printf("\n\nTotal Amount    :RM");
scanf("%f",&a);
printf("Paid Amount     :RM");
scanf("%f",&b);
printf("Balance         :RM%.2f\n",b-a);
printf("\n   **Thank you**");
printf("\n   Welcome Again");
return 0;
}
8
Code:
#include<stdio.h>
main()
{
char z,d[12];
int n,r;
float f;
printf("Enter unite letter          :");
scanf("%c",&z);
printf("Enter item number           :");
scanf("%d",&n);
printf("Enter item price            :");
scanf("%f",&f);
printf("Enter number of units sold  :");
scanf("%d",&r);
printf("Enter purchase date         :");
scanf("%s",d);
printf("\nUnit     Itme    Total Purchase   Purchase Date");
printf("\n----     ----    --------------   -------------");
printf("\n%c",z);
printf("\t  %d",n);
printf("\t     $%.2f",f*r);
printf("\t   %s",d);
return 0;
}
9
Code:
#include<stdio.h>
main()
{
int a[15],b,c,d,h;
float e,f,g;
char z;
printf("*PUAS SDN BHD*\n");

printf("\nMonth          :");
scanf("%s",&a);
printf("\nMeter Reading  :-");
printf("\nPrevious       :");
scanf("%d",&c);
printf("\nCurrent        :");
scanf("%d",&d-c);
printf("\nMonthly Bill Charge for July 2005 :RM%.2f");
scanf("%f",&e);
printf("Previous Bill  :RM%.2f");
scanf("%f",&f);
printf("\nTotal Charge:RM");
scanf("%f",&g);

return 0;