Create multiple C language programs in one compile
What Will I Learn?
- You will learn basic C language
- You will learn to make simple programs
- You will learn how to combine multiple programs in one compile
Requirements
- Have a basic knowledge of C language
- DEV C ++ Compile and Run C/C++ program on Windows
- GCC Compile and Run C / C ++ program on Linux
Difficulty
- Basic
Tutorial Contents
- What is a C programming language ?
- What is the use and should learn ?
Programming Language C
C Programming Language is a computer programming language that can be used to create applications (general-purpose programming language), from operating systems (such as Windows or Linux), antivirus, image processing software, to compilers for programming languages, where C is widely used to create other programming languages which one of them is PHP.
Although it is a general-purpose programming language, a programming language that can create applications, C programming languages are best suited for designing applications that deal directly with Operating Systems and hardware.
- So my goal is how to make some simple program. And combine some simple programs that we have created later into one compile
Some examples of simple C programs
- C program distinguishes small and large numbers, and use if else condition
#include <stdio.h>
int main(){
int i,x,j;
printf("Masukkan Angka Pertama : ");
scanf("%d",&i);
printf("Masukkan Angka Kedua : ");
scanf("%d",&x);
if(i>x){
printf("Angka %d Lebih Besar Dari %d",i,x);
}
else if(i<x){
printf("Angka %d Lebih Kecil Dari %d",i,x);
}
else {
printf("Error!");
}
}
- make declarations on the program
int i,x,j;
- This is to receive the first and second number input
printf("Masukkan Angka Pertama : ");
scanf("%d",&i);
printf("Masukkan Angka Kedua : ");
scanf("%d",&x);
- And this is the if and else condition to process the first and second number input
if(i>x){
printf("Angka %d Lebih Besar Dari %d",i,x);
}
else if(i<x){
printf("Angka %d Lebih Kecil Dari %d",i,x);
}
else {
printf("Error!");
}
- Save and Run.
- The C program is looping using FOR
#include <stdio.h>
int main(){
int i;
for(i=1;i<=10;i++){
printf("\n%d Welcome Utopian-IO \n", i);
}
}
- Save And Run
- A simple C program uses While
#include <stdio.h>
int main(){
int j;
j=1;
while(j<=10){
printf("%d",j);
j++;
}
}
- Save and Run
Merging several C programs to be compiled simultaneously
When finished we create three simple programs using C language, namely: - Programs distinguish small and large numbers, FOR loops, and WHILE programs.
Now it's time we combine all the above programs for the COMPILE simultaneously, see the programs I've combined below:
#include <stdio.h>
int main(){
int i,x,j;
printf("Masukkan Angka Pertama : ");
scanf("%d",&i);
printf("Masukkan Angka Kedua : ");
scanf("%d",&x);
if(i>x){
printf("Angka %d Lebih Besar Dari %d",i,x);
}
else if(i<x){
printf("Angka %d Lebih Kecil Dari %d",i,x);
}
else {
printf("Error!");
}
for(i=1;i<=10;i++){
printf("\n%d Welcome Utopian-IO \n", i);
}
j=1;
while(j<=10){
printf("%d",j);
j++;
}
}
- Save And Run
And that's some simple C programming language and how to merge multiple programs in a single compile.
This tutorial is recommended for newly learned C programming languages, and is not recommended for advanced level.
Posted on Utopian.io - Rewarding Open Source Contributors
Your contribution cannot be approved because it does not follow the Utopian Rules.
Your tutorial is far too trivial to be accepted.
You can contact us on Discord.
[utopian-moderator]
Congratulations @otakngoding! You received a personal award!
Click here to view your Board
Congratulations @otakngoding! You received a personal award!
You can view your badges on your Steem Board and compare to others on the Steem Ranking
Vote for @Steemitboard as a witness to get one more award and increased upvotes!