#include <stdio.h> int main() { int i; printf("ASCII table & its equivalent values with numbering: \n"); for(i=1; i<=255; i++) printf("\nValue: %d -> ASCII character: %c",i,i); getch(); return 0; } Read More »
Tag Archives: c program
C Program to Find if a year is Leap Year or not
Program: #include <stdio.h> main() { int year; clrscr(); printf("Enter a year to check if it is a leap year\n"); scanf("%d", &year); if ( year%400 == 0) printf("%d is a leap year.\n", year); else if ( year%100 == 0) printf("%d is not a leap year.\n", year); else if ( year%4 == 0 ) printf("%d is a leap year.\n", year); else printf("%d ... Read More »
C program to Find the Transpose of a given matrix
Program : #include int main() { int a[4][4],i,j,b; for(i=0;i<4;i++) { printf("\nEnter elements of %d row of Matrix: ",i+1); for(j=0;j<4;j++) scanf("%d",&a[i][j]); } for(i=0;i<4;i++) { for(j=i+1;j<4;j++) { b=a[i][j]; a[i][j]=a[j][i]; a[j][i]=b; } } printf("\n Transposed Matrix:\n\n"); for(i=0;i<4;i++) { for(j=0;j<4;j++) printf("%4d",a[i][j]); printf("\n"); } return 0; } Read More »
C Program to Find the Reverse of a given number by using Recursion
Program : #include <stdio.h> int rev(int,int); int main() { int a; printf("Type a value : "); scanf("%d",&a); printf("Reverse: %d",rev(a,0)); return 0; } int rev(int i,int r) { if(i > 0) return rev(i/10,(r*10)+(i%10)); return r; } Read More »