C Programming Language Basic Programming Examples, C Programming Basics, C Programming Basics Program, C Programming Examples With Output.
C Programming Examples With Output |
1) Wright A Program Enter A Two Numbers Print Its Addition.
#include<stdio.h>
int main ()
{
int
a, b,
c;
printf("Enter
A First Number =");
scanf("%d", &a);
printf("Enter
A Second Number =");
scanf("%d", &b);
c
= a+b;
printf("Addition
=%d", c);
return
0;
}
Output
Enter A First Number = 10
Enter A Second Number = 20
Addition = 30
2) Wright A Program Enter Empolay Sallary, Calculat Tax 10 % And Print Tax Amount And Total Salary.
#include<stdio.h>
int main ()
{
float Sallary, tax, total;
printf("Enter Empolay Sallary =
");
scanf("%f", &Sallary);
tax = Sallary * 0.1;
total = Sallary - tax;
printf("Tax Amount = %f", tax);
printf("\nTotal Sallary =
%f", total);
return 0;
}
Output
Enter Empolay Sallary = 1000
Tax Amount = 100
Total Sallary = 900
3) Wright A Program Enter A Product Cost, Calculat Discount 10 % And Print Discount Amount And Total Amount.
#include<stdio.h>
int main ()
{
float pc, dis, total;
printf("Enter A Product Cost
=");
scanf("%f", &pc);
dis=pc*0.1;
total=pc-dis;
printf("Discount Amount
=%f", dis);
printf("\nToatal Amount
=%f", total);
return 0;
}
Output
Enter A Product Cost = 2000
Discount Amount = 200
Toatal Amount = 1800
4) Wright A Program Enter A Deposit Amount In Bank And Calculate Deviation And Ret Of Interest Find Out Simple Interest And Print On Screen.
#include<stdio.h>
int main ()
{
float
de, du,
re, si;
printf("Enter
A Deposit Amount =");
scanf("%f", &de);
printf("\nEnter
A Deviation =");
scanf("%f", &du);
printf("\nRet
Of Interest =");
scanf("%f", &re);
si=de*du*re/100;
printf("Simple
Interest = %f", si);
return
0;
}
Output
Enter A Deposit Amount In Bank = 10000
Enter A Deviation = 3
Ret Of Interest = 10
Simple Interest = 3000
5) Wright A Program Enter A Product Prics And Gst 10 % Find Out Gst Amount And Total Amount And Display On Screen.
#include<stdio.h>
int main ()
{
float
pp, gst,
total;
printf("Enter
A Product Prics = ");
scanf("%f", &pp);
gst=pp*0.1;
total=pp-gst;
printf("Gst
Amount = %f", dis);
printf("\nToatal
Amount = %f", total);
return
0;
}
Output
Enter A Product Prics = 5000
Gst Amount = 500
Toatal Amount = 4500
6) Wright A Program Enter Marks Of Three Subjects Print Total Marks And Average Marks.
#include<stdio.h>
int main ()
{
float s1, s2,
s3,
total, aver;
printf("Enter Three Subjects Marks = ");
scanf("%f%f%f", &s1,
&s2, &s3);
total=s1+s2+s3;
aver=total/3;
printf("Total Marks = %f", total);
printf("\nAverage Marks =
%f", aver);
return 0;
}
Output
Enter Marks Of Three Subjects = 70 80 90
Total Marks = 240
Average Marks = 80
7) Wright A Program Enter Deposit Account In Bank Calculat Compount Interest 10 % For 3 Yerar Find Out And Print On Screen.
#include<stdio.h>
int main ()
{
float da,fi,si,ti,ci;
printf("Enter Deposit Account =
");
scanf("%f",&da);
fi=da*0.1;
si=(fi+da)*0.1;
ti=(fi+si+da)*0.1;
ci=fi+si+ti;
printf("Compund interest = %f",ci);
return 0;
}
Output :-
Enter Deposit Account = 10000
Compund interest = 3310
Comments
Post a Comment