Welcome to Instructbd

Friday 12 February 2016

Solve the Following Programme



C programming Practice

Note: At First, Solve this Programme Without Using Computer. Then run it in your Computer to Check your Answer.


(a) What is the Output of the following program for the inputs below?

        i) 82    ii) 70   iii) 100   iv) 40   v) 90  vi) 83

#include<stdio.h>
int main()
{
int num;
scanf("%d",&num);
if(num>=60)
{
printf("D");
}
else if(num>=70)
{
printf("C");
}
if(num>80&&num<89)
{
printf("B");
}
else if(num>90)
{
printf("A");
}
else
{
printf("F");
}
printf("\n");

return 0;
}




(b) What is the output of the following program for the inputs below?

     i) 62     ii) 75    iii) 101   iv) 47   v) -90   vi) 83

     #include<stdio.h>
     int main()
    {
       int num;
       scanf("%d",&num);
    if(num%2==0)
      {
        printf("Nice\n");
       }
    if(num<=70)
       {
         printf("Welcome\n");
       }
    else if(num>70)
       {
         printf("Hello\n");
       }
    if(num>=60&&num<89)
      {
       printf("World\n");
      }
    else if(num>40)
      {
         printf("Welcome\n");
      }
   else
     {
        printf("Bye");
     }

    return 0;

}



If you encounter any problem to solve this programme. Please let us know, We'll help you to solve those programme

0 comments:

Post a Comment

Online From Fill-up

Useful links