1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #include<stdio.h> #include<conio.h> void main() { long a,b,c,i; clrscr(); printf("ENTER MULTIPLICATION OF : \n"); scanf("%lu",&a); printf("ENTER VALUE TO : \n"); scanf("%lu",&b); for(i=0;i<=b;i++) { c=a*i; printf("%lux%lu=%lu\n",i,a,c); } getch(); } |
Search This Blog
Tuesday, 6 August 2013
DISPAY ANY MULTIPLICATION TABLE.
Monday, 5 August 2013
ARITHMATIC PROGRESSION OPERATION.
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 36 37 38 39 40 41 42 43 44 45 46 | #include<stdio.h> #include<conio.h> #include<math.h> void main() { int option; long term1,d,limit,i; long sum; clrscr(); next : clrscr(); printf("\nENTER FIRST TERM OF AN A.P\n"); scanf("%lu",&term1); printf("\ENTER DIFFERENCE\n"); scanf("%lu",&d); printf("\nENTER LIMIT LENGTH OF A.P\n"); scanf("%lu",&limit); sum=limit/2*(2*term1+(limit-1)*d); printf("\n SUM : %lu\n",sum); printf(" %lu ",term1); for(i=1;i<limit;i++) { term1=term1+d; printf(" %lu ",term1); } printf("\n DO YOU WISH TO CREATE MORE A.P?\n"); printf("\n 1 : TO CONTINUE\n 2 : TO EXIT \n "); scanf("%d",&option); switch (option) { case 1 : goto next; break; case 2 : printf("\n PRESS ENTER TO EXIT\n"); break; default : printf("\n U HAVE ENTERED AN INVALID\n"); break; } getch(); } |
Sunday, 4 August 2013
DISPLAY EVEN NUMBERS.
1 2 3 4 5 6 7 8 9 10 11 12 13 | #include<stdio.h> #include<conio.h> void main() { int i,n=20; clrscr(); for(i=0;i<=20;i++) if(i%2==0) printf("\t %d \n",i); getch(); } |
Saturday, 3 August 2013
CONVERT DECIMAL NUMBER TO BINARY
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include<stdio.h> #include<conio.h> #include<math.h> void main() { int n,k=0,b[10],i=0; clrscr(); printf("ENTER A NUMBER\n"); scanf("%d",&n); while(n>0) { b[i]=n%2; n=n/2; i++; k++; } for(i=k-1;i>=0;i--) { printf("%d",b[i]); } getch(); } |
COMPARE STRINGS.
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> #include<string.h> void main() { int n; char string1[50],string2[50]; clrscr(); puts("\n ENTER ANY WORD \t"); gets(string1); puts("\n ENTER SECOND WORD \t"); gets(string2); n=strcmp(string1,string2); if(n==0) puts("\t BOTH SIZE OF STRINS ARE EQUAL\n"); else if(n<0) puts("\n \t THE FIRST STRING IS GREATER\n "); else if(n>0) puts(" \n \t THE FIRST STRING IS SMALLER \n"); getch(); } |
ADD NEW NAME TO END OF TO ANOTHER STRING.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #include<stdio.h> #include<conio.h> void main() { char string1[80],string2[80]; clrscr(); printf("ENTER FIRST STRING\n"); scanf("%s",&string1); printf("ENTER SECOND STRING\n"); scanf("%s",&string2); strcat(string1,string2); printf("BOTH STRINGS JOINED TOGETHER IS %s",string1); getch(); } |
CONVERT UPPER CASE CHARACTER TO LOWER.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include<stdio.h> #include<conio.h> #include<string.h> void main() { char word[80]; clrscr(); printf("ENTER ANY WORD OR NAME\n"); scanf("%s",&word); strlwr(word); printf("conevterd to %s ",word); getch(); } |
CONVERT ALL LOWER CASE CHARACTER TO UPPER CASE.
FIND LENGTH OF A CHARACTER.
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 word[80]; int len; printf("ENTER ANY WORD OR NAME\n"); scanf("%s",&word); len=strlen(word); printf("U HAVE ENTERED %d CHARACTERS\n",len); } |
DISPLAY REVERS OF A CHARACTER
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #include<stdio.h> #include<conio.h> #include<string.h> void main() { char a[80]; clrscr(); printf("ENTER A WORD \n"); scanf("%s",&a); strrev(a); printf("REVERSE OF THE CHARACTER U ENTERED IS %s",a); getch(); } |
SUM OF TWO NUMBERS.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #include<stdio.h> #include<conio.h> void main() { int a,b,c; printf("ENTER FIRST NUMBER \n"); scanf("%d",&a); printf("ENTER SECOND NUMBER\n"); scanf("%d",&b); c=a+b; printf("SUM IS %d",c); getch(); } |
Subscribe to:
Posts (Atom)