programming in C code example
Example 1: c
#include <stdio.h>
int main() {
printf("Hello, world!");
return 0;
}
Example 2: c language tutorial
#include <stdio.h>
int main() {
printf("Hello, World! \n");
return 0;
}
Example 3: functions in c programming
#include <stdio.h>
void introduction()
{
printf("Hi\n");
printf("My name is Chaitanya\n");
printf("How are you?");
}
int main()
{
introduction();
return 0;
}
Example 4: functions in c programming
#include <stdio.h>
int addition(int num1, int num2)
{
int sum;
sum = num1+num2;
return sum;
}
int main()
{
int var1, var2;
printf("Enter number 1: ");
scanf("%d",&var1);
printf("Enter number 2: ");
scanf("%d",&var2);
int res = addition(var1, var2);
printf ("Output: %d", res);
return 0;
}
Example 5: c programming language
#include <stdio.h>
#include <stdlib.h>
int main() {
printf("Hello, world!\n");
char* myString = "An awesome string!";
printf("%s\n", myString);
int myInt = 10;
printf("%d\n", myInt);
double myDouble = 5.2;
printf("%f\n", myDouble);
return 0;
}
Example 6: c programming language
Do not want to be rude but I learnt this language and found out it has no class.
Prefer languages with class like C++, C#, Java, Python, etc.
Be classy.