boost learn study
Showing posts with label
Array
.
Show all posts
Showing posts with label
Array
.
Show all posts
Friday, March 28, 2014
Two-Dimensional Array
/*Below program showing Two Dimensional array...*/ #include
#include
void main() { int a[2][2],r,c; clrscr(); printf("\n\tTwo Dimensional Array\t\n"); printf("\n\t======================\t\n"); printf("\n\tEnter the Rows and Columns:\t\n"); for(r=0;r<2;r++) { for(c=0;c<2;c++) { scanf("%d",&a[r][c]); } } printf("\n\tAfter the Inputting Array:\t\n"); for(r=0;r<2;r++) { for(c=0;c<2;c++) { printf("\t %d \t",a[r][c]); } printf("\n"); } getch(); }
Output is as :
Read more �
Linear Array or One/Single Dimensional Array
/*Below program showing Liner array...*/ #include
#include
void main() { int a[5],i,sum=0; clrscr(); printf("\n Enter the Number:"); for(i=0;i<5;i++) { scanf("\t%d",&a[i]); } printf("\n After the Inputting Array:\n"); for(i=0;i<5;i++) { printf("\na[%d]=%d"i,a[i]); sum = sum + a[i]; } printf("\nSum=%d",sum); getch(); }
Output is as :
Read more �
Older Posts
Home
Subscribe to:
Posts (Atom)