Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save henideepak/011105132a437176b3a50b5440605549 to your computer and use it in GitHub Desktop.
Save henideepak/011105132a437176b3a50b5440605549 to your computer and use it in GitHub Desktop.
How to work c program in terminal command in ubuntu
#include<stdio.h>
int main()
{
int a, b, c;
printf("Hello User This is my First Program In C Language\n");
printf("Enter two numbers to add\n");
scanf("%d%d", &a, &b);
c = a + b;
printf("Sum of the numbers = %d\n", c);
return 0;
}
How to work c program in terminal command in ubuntu
once you checked GCC version
command = gcc --version
install c compiler
command = sudo apt install build-essential
create a file
command = touch hello.c
open in a sublime text editor
command = subl hello.c
create an output file
command = gcc hello.c -o hello
run file
command = ./hello
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment