DO NOT MISS

Ads

Wednesday, 23 November 2016

C-Programs Using 2-D Array (Dynamic Time)



Dynamic time :-
By using this scanf() we can assining the values to dynamically ( or ) in runtime .In again we can assign the values in two ways using scanf().

1. Without using loops.
2. With using loops.

1. Without using loops :-
scanf("%d",& a[0][0]);
scanf("%d",&a[0][1]);
scanf("%d",& a[0][2]);
scanf("%d",&a[1][0]);
scanf("%d",& a[1][1]);
scanf("%d",& a[1][2]);

2. With using loops :-
for(i=1;i<=r-1;i++)
       {
            for(j=1;j<=c-1;j++)
                     scanf("%d",&a[i][j]);
       }

Displaying 2 D values :-
for(i=1;i<=r-1;i++)
      {
           for(j=1;j<=c-1;j++)
                  printff("%d",a[i][j]);
                  printf("\n");
       }



________________________________________

_____________________________________________________________________________


Greataims

 
Copyright © 2016 Computersadda. Designed by @ Computersadda Team - Published By Greataims