More Example Using Loops
More Example Using Loops
More Example Using Loops
printf("\n")
R. K. Ghosh (IIT-Kanpur)
C Programming
4 / 10
/ P r i n t f i r s t row o f t h e c a l e n d a r , and s u b s e q u e n t r o w s o f t h e c a l e n d a r / }
R. K. Ghosh (IIT-Kanpur)
C Programming
4 / 10
p r i n t f ( I n v a l i d day \n ) ;
r e t u r n 1;
// P r i n t r e s t o f t h e o t h e r r o w s o f t h e c a l e n d a r f o r ( ; i <=n ; i=i +7) { f o r ( j = 1 ; j <= 7 ; j ++) { m =i+j ; i f (m <= n ) p r i n t f ( %6d ,m) ; e l s e break ; } p r i n t f ( \n ) ; }
R. K. Ghosh (IIT-Kanpur)
C Programming
4 / 10
C Programming Characters
R. K. Ghosh (IIT-Kanpur)
C Programming
1/1
C Programming Characters
R. K. Ghosh (IIT-Kanpur)
C Programming
1/1
C Programming Characters
R. K. Ghosh (IIT-Kanpur)
C Programming
1/1
C Programming Characters
R. K. Ghosh (IIT-Kanpur)
C Programming
1/1
C Programming Characters
C Programming Characters
R. K. Ghosh (IIT-Kanpur)
C Programming
1/1
C Programming Characters
R. K. Ghosh (IIT-Kanpur)
C Programming
1/1
C Programming Characters
R. K. Ghosh (IIT-Kanpur)
C Programming
1/1
C Programming Characters
do { n = n 10 + ch 4 8 ; // C o v e r s i o n f o r m u l a } w h i l e ( ( ch = g e t c h a r ( ) ) != \n ) p r i n t f ( n = %d \n , n s i g n ) ; }
R. K. Ghosh (IIT-Kanpur)
C Programming
1/1
C Programming Characters
R. K. Ghosh (IIT-Kanpur)
C Programming
1/1