0% found this document useful (0 votes)
63 views

Programming: Computer System & Programming Letusc Yashavant Kanetkar

This document discusses various C programming concepts like printf and scanf statements, calculating sums and interest, and inputting/outputting values. It includes examples of using printf to output text and values, scanf to input values, and calculating totals. The examples demonstrate basic C programming techniques like declaring variables, taking user input, performing calculations, and displaying output.

Uploaded by

Sahir Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views

Programming: Computer System & Programming Letusc Yashavant Kanetkar

This document discusses various C programming concepts like printf and scanf statements, calculating sums and interest, and inputting/outputting values. It includes examples of using printf to output text and values, scanf to input values, and calculating totals. The examples demonstrate basic C programming techniques like declaring variables, taking user input, performing calculations, and displaying output.

Uploaded by

Sahir Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 12

Programming

Computer System &


programming
Let Us C
Yashavant kanetkar
Usage of printf Statement.

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

You might also like