1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #include<stdio.h> #include<conio.h> void main() { int a,b,c; clrscr(); printf("ENTER A NUMBER\n"); scanf("%d",&a); printf("ENTER SECOND NUMBER\n"); scanf("%d",&b); if(a==b) { printf("\n \n YES %d IS EQUAL TO %d\n",a,b); printf("BOTH NUMBERS ARE EQUAL\n"); } else { if(a>b) { c=a-b; printf("\n %d is GREATER THAN %d",a,b); printf("\n DIFFERENCE IS %d",c); } if(a<b) { c=b-a; printf("\n %d IS GREATER THAN %d",b,a); printf("\n DIFFERENCE IS %d",c); } printf("\n ANYWAY %d IS NOT EQUAL TO %d\n",a,b); } getch(); } |
Search This Blog
Monday, 9 September 2013
FIND LENGTH OF ENTRED NUMBER.
FIND GREATER NUMBER FROM 3 NUMBERS
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #include<stdio.h> #include<conio.h> void main() { int a,b,c; clrscr(); printf("ENTER A NUMBER\n"); scanf("%d",&a); printf("ENTER SECOND NUMBER\n"); scanf("%d",&b); if(a==b) { printf("\n \n YES %d IS EQUAL TO %d\n",a,b); printf("BOTH NUMBERS ARE EQUAL\n"); } else { if(a>b) { c=a-b; printf("\n %d is GREATER THAN %d",a,b); printf("\n DIFFERENCE IS %d",c); } if(a<b) { c=b-a; printf("\n %d IS GREATER THAN %d",b,a); printf("\n DIFFERENCE IS %d",c); } printf("\n ANYWAY %d IS NOT EQUAL TO %d\n",a,b); } getch(); } |
CONVERT A STRING TO ANOTHER SPECIFIED STRING.
1 2 3 4 5 6 7 8 9 10 11 12 13 | #include<stdio.h> #include<conio.h> #include<string.h> void main() { char string[50]; clrscr(); printf("ENTER A STRING\n"); scanf("%s",&string); strset(string,'*'); printf("%s",string); getch(); } |
Subscribe to:
Posts (Atom)