Skip to main content

C Programming Examples | C Examples | C programming Exercises, Practice, Solution

C practice programs

 

Here are few very simple and basic C language programs with C programming examples that you will use to understand the basics very easily.


Write a C programme to calculate area of a rectangle :

#include<stdio.h>
int main(){

          Int l, b, area;
          printf(“Enter length and breadth of a rectangle \n”);
          scanf(“%d %d”, &l, &b);
          area = l *b;
          printf(“Area of rectangle is %d \n”, area);
          return 0;
}

Write a C program to calculate area of a circle :

#include<stdio.h>
int main(){

          float r, area;
          printf(“Enter the radius of the circle \n”);
          scanf(“%f”, &r);
          area = 3.14*r*r;
          printf(“Area of circle is %f \n”, area);
          return 0;
}

Write a C program to calculate simple intrest (SI) :

#include<stdio.h>
int main(){

          float p, r, t , si;
          printf(“Enter the values of p, r, and t respectively \n”);
          scanf(“%f %f %f”, &p, &r, &t);
          si= p * r * t /100;
          printf(“Simple interest is %f \n”, si);
          return 0;
}

 

Comments

Popular posts from this blog

What Are Variables in C language | Constants and Keywords in language

Variables are the containers in C language which are used to store data in the program. Variables are the small memory blocks which holds some values in it. Variables in c language :       What are variables in C language ?     In C language, A variable is just like a container that contains values of different data           types. A variable is an entity whose value can be change.      This means that to store any value we use variables in C language. These variables can e        imagined as the small memory blocks in which the data is stored of different types. The           variables are the one of important components of c language as it is used most                          frequently inside the programs of C language.        For Instance In our Kitchen we have differen...

What is C language | C language uses | Topics of C language

In this blog I will tell you the most common uses of C language Programming and the Topics that I will cover in my Tutorial of C Language What are the uses of c language ? C language is used to code a wide variety of advance systems that are very fast executed and works efficiently . C was developed for the development of unix operating system (OS). Major parts of windows , linux , and other operating systems are written using C language. C is widely used to write device driver programs such as driver programs for hardwares like tablets, printers,routers , keyboard and mouses etc . C language is used to program embedded system where requirement of execution speed is very faster and also it has to be executed in a limited memory. These type of programs are written is C language to archive the faster execution in limited memory. the devices for which these type of programs are written can be Microwave ovens, Cameras, smart washing machines , refrigrators etc. Apart from that C language i...