1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #include<stdio.h> #include<conio.h> void main() { int i; int a[10]={1,2,3,4,5,6,7,8,9,10}; clrscr(); for(i=10;i>=1;i--) { printf("%d,",a[i]); } getch(); } |
Search This Blog
Monday, 23 September 2013
DISPLAY NATURAL NUMBERS IN REVERS ORDER
Thursday, 12 September 2013
WRITE NAME USING 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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | #include<stdio.h> #include<conio.h> #include<string.h> int n,i; char alp[80]="0ABCDEFGHIJKLMNOPQRSTUVWXYZ"; struct names { int value; }v[80]; void main() { void read(); void calculate(); void display(); clrscr(); printf("ENTER LENGTH\n"); scanf("%d",&n); for(i=1;i<=26;i++) { printf("%d)%c\n",i,alp[i]); } read(); display(); getch(); } void read() { printf("ENTER WORD NUMBERS \n"); for(i=1;i<=n;i++) { scanf("%d",&v[i].value); } } void display() { printf("OUTPUT IS:\n\n"); for(i=1;i<=n;i++) { if(v[i].value!=0) printf("%c",alp[v[i].value]); } } |
Tuesday, 10 September 2013
FIND LENGH OF STRING
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> #include<string.h> void main() { char n[90]; int len; clrscr(); printf("ENTER A NUMBER OR STRING\n"); scanf("%s",&n); len=strlen(n); printf("%d",len); getch(); } |
Monday, 9 September 2013
FIND LENGTH OF ENTRED NUMBER.
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(); } |
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(); } |
Sunday, 8 September 2013
FIND WHICH DAY IS.
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 47 48 49 50 51 | #include<stdio.h> #include<conio.h> #include<string.h> void main() { int option; clrscr(); printf("ENTER ANY NUMBER IN 7 DAY IN WEEK\n"); scanf("%d",&option); switch(option) { case 1 : printf("SUNDAY\n"); break; case 2 : printf("MONDAY\n"); break; case 3 : printf("TUESDAY\n"); break; case 4: printf("WEDNESDAY\n"); break; case 5 : printf("THURSDAY\n"); break; case 6 : printf("FRYDAY\n"); break; case 7 : printf("WEDNESSDAY\n"); break; default : printf("INVALID INPUT\n"); break; } getch(); } |
FIND A LETTER FROM ENGLISH ALPHABET
Wednesday, 4 September 2013
FIND LARGE NUMBER FROM 3 NUMBERS
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #include<stdio.h> #include<conio.h> void main() { int a,b,c,large; clrscr(); printf("ENTER 3 NUMBERS\n"); scanf("%d%d%d",&a,&b,&c); if(a<b) large=b; else large=a; if(c>b) large=c; printf("THE LARGE NUMBER IS %d",large); getch(); } |
CATOGORIZE ODD NUMBERS AND EVEN NUMBERS SPERATLY.
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 47 48 49 50 51 52 53 54 55 56 57 58 | #include<stdio.h> #include<conio.h> int i,n; struct numbers { int n1,odd,even; }num[90]; void main() { void read(); void display1(); void display2(); clrscr(); printf("ENTER LIMIT\n"); scanf("%d",&n); read(); display1(); display2(); getch(); } void read() { printf("\n ENTER %d NUMBERS\n",n); for(i=1;i<=n;i++) { scanf("%d",&num[i].n1); } } void display1() { printf("\nODD NUMBERS\n"); for(i=1;i<=n;i++) { if(num[i].n1%2==1) printf("\t %d ,",num[i].n1); } } void display2() { printf("\n EVEN NUMBERS\n"); for(i=1;i<=n;i++) { if(num[i].n1%2==0) printf("\t %d ,",num[i].n1); } } |
CONVERT A LIST OF NUMBERS TO A SPECIFIED NUMBER.
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 47 48 49 50 51 52 53 54 55 56 57 58 59 | #include<stdio.h> #include<conio.h> #include<string.h> int n,i,i2,i3; struct number { int number; }num[50]; void main() { void read(); void display(); void replace(); clrscr(); printf("ENTER LIMIT OF HOW MANY NUMBER ENTER TO LIST\n"); scanf("%d",&n); read(); display(); replace(); getch(); } void read() { printf("ENTER NUMBERS\n"); for(i=1;i<=n;i++) { scanf("%d",&num[i].number); } } void display() { for(i=1;i<=n;i++) { printf("\t %d , ",num[i].number); } } void replace() { printf("\n \n REPLACE\t"); scanf("%d",&i2); printf("\n \n TO\t"); scanf("%d",&i3); printf("SPECIFIED NUMBER REPLACED \n"); for(i=1;i<=n;i++) { if(num[i].number==i2) num[i].number=i3; printf("%d ,",num[i].number); } } |
Sunday, 1 September 2013
CONVERT ONE NAME TO ANOTHER.
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 w1[50],w2[50]; clrscr(); printf("ENTER FIRST WORD\n"); scanf("%s",&w1); strcpy(w2,w1); printf("\n %s",w2); getch(); } |
FIND REVERS OF A NAME.
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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | #include<iostream.h> #include<conio.h> #include<string.h> #include<stdio.h> int n,i; struct student { int len; char name[100]; }std[100]; void main() { cout<<"\n ___________________________________________________________________\n"; cout<<"\n FIND REVERSE OF UR FRIENDS NAMES AND LENGTH OF HIS\HER NAME\n"; cout<<"ENTER A LIMIT THAT HOW MANY STUDENTS NAME U WANTS GET TO BE CALCULATED\n"; cin>>n; void read(); void calculate(); void display(); read(); calculate(); display(); getch(); } void read() { cout<<"\n ___________________________________________________________________\n"; printf("\n ENTER NAME %d NAMES \n",n); for(i=0;i<n;i++) { scanf("%s",&std[i].name); } } void calculate() { for(i=0;i<n;i++) { strupr(std[i].name); strrev(std[i].name); std[i].len=strlen(std[i].name); } } void display() { for(i=0;i<n;i++) { printf("\n %s : %d",std[i].name,std[i].len); } } |
Subscribe to:
Posts (Atom)