Suppose that an integer variable m contains the value 90 ie

Suppose that an integer variable m contains the value 90 (i.e: int n = 90;) Write the print statement so that it produces the output 90% usually means a \"A\". Consider the below segment If you enter 3 in the console as input what does printf statement print ? Write down the values for all variable appearing in each statement.(this one is tricky)

Solution

Solution1.c

#include <stdio.h>//header file for inupt output function

int main()
{//main function
    int n=90;//%d%% prints 90%
    printf(\"%d%% usually means a %cA%c \",n,\'\"\',\'\"\');
    return 0;//%cA%c Prints \"A\"
}

output

90% usually means  a \"A\"

Solution2.c

#include <stdio.h>//header file for inupt output function

int main()
{//main function
    int k;
   printf(\"enter the k value :\");
    k=getchar();//keyboard inputting
    printf(\"%d\ \",k);//ascii value of 3 is 51
return 0;
}

output

enter the k value :3                                                                                                                                                     

51     

Solution3.c

#include <stdio.h>//header file for inupt output function

int main()
{//mainfunction
    int x,y,z;//variable declaration
    float a,b;
    a=2.5,b=3.14;
    x=3; y=5.3; z=2;
    x+=y+a*z-b;//variable assigmnets
    z+=(x==y);
    x==(a=b);
    printf(\"x=%dy=%dz=%d\ \",x,y,z);
    printf(\"x=%d\ \",x);
    printf(\"z=%d\ \",z);
    printf(\"x=%d\ \",x);
    return 0;//%cA%c
}


output

x=9y=5z=2                                                                                                                                                                

x=9                                                                                                                                                                      

z=2                                                                                                                                                                      

x=9   

  

 Suppose that an integer variable m contains the value 90 (i.e: int n = 90;) Write the print statement so that it produces the output 90% usually means a \
 Suppose that an integer variable m contains the value 90 (i.e: int n = 90;) Write the print statement so that it produces the output 90% usually means a \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site