Computer Science » C Program » C Program Examples "How to print hello, world! using c program ? How to find area of a circle using c program ? How to find smallest element in an array using c program ? You all must have this kind of questions in your mind. Below article will solve this puzzle of yours. Just take a look.” - Here we have listed all the programs in C programming language, categorised under different progamming concepts like Basic, Area, Mathematical, Number, Array etc. Check the respective category to view all the programs under that category. C Programs - Basic C Programs C Programs - Number Programs C Programs - Area Programs C Programs - Mathematical Programs C Programs - Array Programs C Programs - Electrical Programs C Programs - Pyramid Programs
Computer Science » C Program » Swap Two Numbers Without using Third Variable Program : [php]#include<stdio.h> int main() { int a, b; printf("nEnter value for num1 & num2 : "); scanf("%d %d", &a, &b); a = a + b; b = a - b; a = a - b; printf("nAfter swapping value of a : %d", a); printf("nAfter swapping value of b : %d", b); return (0); }[/php] Output : [php]Enter value for num1 & num2 : 1 2 After swapping value of a : 2 After swapping value of b : 1[/php]
Computer Science » C Program » Rectangle using Line and Special Symbols Program : [php]#include<stdio.h> int main() { int i, j; for (i = 0; i < 10; i++) { printf("n"); for (j = 0; j < 10; j++) { if (i == 0 || i == 9 || j == 0 || j == 9) printf("▲"); else printf("-"); } } return (0); }[/php] Output : [php]▲▲▲▲▲▲▲▲▲▲ ▲--------▲ ▲--------▲ ▲--------▲ ▲--------▲ ▲--------▲ ▲--------▲ ▲--------▲ ▲--------▲ ▲▲▲▲▲▲▲▲▲▲[/php]
Computer Science » C Program » Find the Number of Elements in An Array Program : [php]#include <stdio.h> int main() { int array[] = {10, 20, 30, 40, 50, 60, 70,80,90,100}; int n,m; n = sizeof(array); m = n/sizeof(int); printf("Size of the given array is : %d", m); return 0; }[/php] Output : [php]Size of the given array is : 10[/php]