#include<stdio.h>
int main()
{
int i = 0;
char ch;
for (i = 0; i < 256; i++) {
printf("%c ", ch);
ch = ch + 1;
}
Output :
Å É æ Æ ô ö ò û ù ÿ Ö Ü ¢ £ ¥ ₧ ƒ á í ó ú ñ Ñ ª º ¿ ⌐ ¬ ½ ¼ ¡ « » ░ ▒ ▓ │ ┤ ╡ ╢
╖ ╕ ╣ ║ ╗ ╝ ╜ ╛ ┐ └ ┴ ┬ ├ ─ ┼ ╞ ╟ ╚ ╔ ╩ ╦ ╠ ═ ╬ ╧ ╨ ╤ ╥ ╙ ╘ ╒ ╓ ╫ ╪ ┘ ┌ █ ▄ ▌ ▐
▀ α ß Γ π Σ σ µ τ Φ Θ Ω δ ∞ φ ε ∩ ≡ ± ≥ ≤ ⌠ ⌡ ÷ ≈ ° ∙ · √ ⁿ ² ■ ☺ ☻ ♥ ♦ ♣ ♠
♫ ☼ ► ◄ ↕ ‼ ¶ § ▬ ↨ ↑ ↓ ← ∟ ↔ ▲ ▼ ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6
7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ ] ^
_ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~ ⌂ Ç ü é â ä à å
ç ê ë è ï î ì Ä
Computer Science » C Program » Delete an Element from Specified Location from Array Program : [php]#include<stdio.h> int main() { int arr[30], num, i, loc; printf("nEnter no of elements : "); scanf("%d", &num); //Read elements in an array printf("nEnter %d elements : ", num); for (i = 0; i < num; i++) { scanf("%d", &arr[i]); } //Read the location printf("nLocation of the element to be deleted : "); scanf("%d", &loc); /* loop for the deletion */ while (loc < num) { arr[loc - 1] = arr[loc]; loc++; } num--; // No of elements reduced by 1 //Print Array for (i = 0; i < num; i++) printf("n %d", arr[i]); return (0); }[/php] Output : [php]Enter no of elements : 5 Enter 5 elements : 10 20 30 40 50 Location of the element to be deleted : 3 10 20 40 50[/php]
Computer Science » C Program » Prime Number Pyramid Program : [php]#include<stdio.h> int prime(int num); int main() { int i, j; int num = 2; for (i = 0; i < 5; i++) { printf("n"); for (j = 0; j <= i; j++) { while (!prime(num)) { num++; } printf("%dt", num++); } } return (0); } int prime(int num) { int i, flag; for (i = 2; i < num; i++) { if (num % i != 0) flag = 1; else { flag = 0; break; } } if (flag == 1 || num == 2) return (1); else return (0); }[/php] Output : [php]2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 [/php]
Computer Science » C Program » Calculate Sum and Average of an Array Program : [php]#include <stdio.h> int main() { int Arr[50]; int n, i, sum = 0; float average; printf("Enter the number of elements in Array : "); scanf("%d", &n); for (i = 0; i < n; i++) { printf("nEnter element %d : ", i + 1); scanf("%d", &Arr[i]); sum = sum + Arr[i]; } average = (float)sum/n; printf("nThe sum of the elements array is : %d", sum); printf("nThe average of the elements array is : %0.2f", average); return 0; }[/php] Output : [php]Enter the number of elements in Array : 5 Enter element 1 : 20 Enter element 2 : 30 Enter element 3 : 40 Enter element 4 : 50 Enter element 5 : 60 The sum of the elements array is : 200 The average of the elements array is : 40.00[/php]
Computer Science » C Program » Insert Element in An Array Program : [php]#include<stdio.h> int main() { int arr[30], element, num, i, location; printf("nEnter no of elements : "); scanf("%d", &num); for (i = 0; i < num; i++) { scanf("%d", &arr[i]); } printf("nEnter the element to be inserted : "); scanf("%d", &element); printf("nEnter the location : "); scanf("%d", &location); //Create space at the specified location for (i = num; i >= location; i--) { arr[i] = arr[i - 1]; } num++; arr[location - 1] = element; //Print out the result of insertion for (i = 0; i < num; i++) printf("n %d", arr[i]); return (0); }[/php] Output : [php]Enter no of elements : 5 10 20 30 40 50 Enter the element to be inserted : 60 Enter the location : 3 10 20 60 30 40 50[/php]
Computer Science » C Program » Reversing an Array Elements Program : [php]#include<stdio.h> int main() { int arr[30], i, j, num, temp; printf("nEnter no of elements : "); scanf("%d", &num); //Read elements in an array for (i = 0; i < num; i++) { scanf("%d", &arr[i]); } j = i - 1; // j will Point to last Element i = 0; // i will be pointing to first element while (i < j) { temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; i++; // increment i j--; // decrement j } //Print out the Result of Insertion printf("nArray after reversal : "); for (i = 0; i < num; i++) { printf("%d t", arr[i]); } return (0); }[/php] Output : [php]Enter no of elements : 5 10 20 30 40 50 Array after reversal : 50 40 30 20 10 [/php]