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 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...

What is C language | C language tutorial | C language basics

  C is a general-purpose programming language created by Dennis Ritchie at the Bell Laboratories in 1972.  C is strongly associated with UNIX, as it was developed to write the UNIX operating system. C Language Tutorial : What is C? C is a general-purpose programming language created by Dennis Ritchie at the Bell Laboratories in 1972. It is a very popular language, despite being old. C is strongly associated with UNIX, as it was developed to write the UNIX operating system. Why Learn C? It is one of the most popular programming language in the world If you know C, you will have no problem learning other popular programming languages such as Java, Python, C++, C#, etc, as the syntax is similar C is very fast, compared to other programming languages, like  Java  and  Python C is very versatile; it can be used in both applications and technologies