Code for pattern 1 Get link Facebook X Pinterest Email Other Apps Code for Pattern 1 *** *** *** #include<stdio.h> #include<conio.h> void main() { int i,j; for(i=1;i<=3;i++) { for(j=1;j<=3;j++) { printf("*"); } printf("\n"); } getch(); } Output Get link Facebook X Pinterest Email Other Apps Comments
Code for array display Code for array display #include<stdio.h> #include<conio.h> void main() { int i,a[5]; printf("Enter 3 elements"); for(i=0;i<3;i++) { scanf("%d",&a[i]); } printf("Array is "); for(i=0;i<3;i++) { printf("%d",a[i]); } getch(); } Output Read more
Code for reversing of a number(Using while loop) Code for reversing of a number(Using while loop) #include<stdio.h> #include<conio.h> void main() { int r=0,c,n; printf("Enter any number"); scanf("%d",&n); while(n>0) { c=n%10; n=n/10; r=r*10+c; } printf("Reverse=%d",r); getch(); } Output Read more
Code for pattern 2 Code for pattern 2 * ** *** **** #include<stdio.h> #include<conio.h> void main() { int i,j; for(i=1;i<=4;i++) { for(j=1;j<=i;j++) { printf("*"); } printf("\n"); } getch(); } Output Read more
Comments
Post a Comment