Programming: Computer System & Programming Letusc Yashavant Kanetkar
Programming: Computer System & Programming Letusc Yashavant Kanetkar
Void main ()
{
Clrscr ();
Printf ("my name is .......");
Printf ("my Roll No is .......");
getch ();
}
Output
By using next line \n and Tab \t.
void main()
{
clrscr();
printf("my name is ......\n ");
printf("my Roll No is .......");
getch();
}
Output
Usage of Scanf Statement
void main()
{
int roll_no;
clrscr();
printf("\n\n\n\t\t\t my name is Kashan\n ");
printf("\n\n\n\t\t\t my Roll No is : ");
scanf("%d",&roll_no);
getch();
}
Output
sum
void main()
{
int a,b,c;
clrscr();
a=100;
b=3;
c=a+b;
Printf (“Sum of\n two integer= %d",c);
getch();
}
A simple C program to calculate simple
interest.
void main()
{
int p,n,r,si;
clrscr();
printf("enter the value of principle amount P=");
scanf("%d",&p);
printf("enter the number of months n=");
scanf("%d",&n);
printf("enter the rate of interest r=");
scanf("%d",&r);
si=p*n*r/100;
printf(" simple interest= %d",si);
getch();
}
Output
Q.No.(a) Ramesh’s basic salary is input through the
keyboard. His dearness allowance is 40% of basic salary, and
house allowance is 20% of basic salary. Write a program to
calculate his gross salary?
void main()
{
int b_salary,dearn_al,house_al,gross_sl;
clrscr();
printf("enter the basic salary =");
scanf("%d",&b_salary);
dearn_al=b_salary*40/100;
house_al=b_salary*20/100;
gross_sl=b_salary+dearn_al+house_al;
printf("gross salary = %d",gross_sl);
getch();
}
Output