Thursday, August 19, 2010

TO FIND LARGE AND SMALL NUMBERS AMONG A SET OF NUMBERS

0 comments
#include<stdio.h> #include<conio.h> void main() { int lar,sma,i,num,a[10]; clrscr(); printf("Enter how many numbers: "); scanf("%d",&num); printf("Enter numbers: "); for(i=0;i<num;i++) { scanf("%d",&a[i]); } lar=sma=a[0]; for(i=1;i<num;i++) { if(a[i]>lar) lar=a[i]; if(a[i]<sma) sma=a[i]; } { printf("The large number is =%d and small is =%d",lar,sma); } getch(); } ...
Continue reading →

TO FIND THE ASCII VALUE

0 comments
#include<stdio.h> #include<conio.h> #include<string.h> void main() { char str[20]; int i,len;  clrscr(); printf("Enter string: "); gets(str); len=strlen(str); for(i=0;i<len;i++) { printf("%c = %d ,  ",str[i],str[i]); } getch(); } ...
Continue reading →