This quiz is meant to give you an idea of how well you understand the material covered in the first third of the course. Your performance on this quiz does not affect your grade in the course; it is meant only to provide feedback to you about how you're doing.
main()
{
int m , months , years ;
float payment , rate , mrate , balance = 0.0 ;
if( scanf( "%f %f %d" , &payment , &rate , &years ) == 3 )
{
months = years * 12 ;
mrate = 1.0 + ( rate / 100.0 ) / 12.0 ;
for( m = 0 ; m < months ; )
{
balance += payment ;
balance *= mrate ;
m ++ ;
printf( "%d %.2f\n" , m , balance ) ;
}
}
else
printf("Error reading input.\n") ;
}
main()
{
int c ;
int cc = 0 , wc = 0 , lc = 0 ;
int state = 0 ;
float awl , all ;
while ( ( c = getchar() ) != EOF )
{
cc ++ ;
switch ( state )
{
case 0:
if ( isalpha(c) )
{
state = 1 ;
wc ++ ;
}
break ;
case 1:
if ( ! isalpha(c) )
state = 0 ;
break ;
}
if ( c == '\n' )
lc ++ ;
}
awl = (float)cc / (float)wc ;
all = (float)cc / (float)lc ;
printf( "%d %d %d %.2f %.2f\n" , lc , wc , cc , all , awl ) ;
}
main()
{
int i = 0 , j = 0 ;
scanf( "%d %d" , &i , &j ) ;
i += 2 ;
j -= 2 ;
if ( ( i = 7 ) && ( j = 9 ) )
printf( "yes\n" ) ;
else
printf( "no\n" ) ;
printf( "%d %d\n" , i , j ) ;
}
Solutions:
Copyright © 1999, Ray Ontko (rayo@ontko.com).