Problem 6: Variable

Take three integer variables a, b and c. Assign values to the variables- a = 10, b = 20 and c = 30; Now print the sum of these three variables.

Code: 
 

#include<stdio.h> 
 
int main()
{
 
    int a;
    int b;
    int c;
 
    a=10;
    b=20;
    c=30;
    printf("%d\n",a+b+c);
 
    return 0;
}
	

Problem 7: ASCII Values

Write a program to print the following output:

Ascii value of ‘A’ is: ____

Ascii value of ‘@’ is: ____

In the blank space you should show the ascii code of the given characters.

Code: 
 

    #include<stdio.h> 
 
int main()
{

    printf("Ascii value of 'A' is: %d\n",'A');
    printf("Ascii value of '@' is: %d\n",'@');

    return 0;
}
		
Problem 8: Average

Take four double variables x, y, z and avg. Assign values to x, y and z as you want. Now calculate the average of x, y and z and assign it to avg. Finally print the average value like-

Average of x, y and z is: —– .

Code: 
 

    #include<stdio.h> 
 
int main()
{

   double x,y,z,avg;

   x=10;
   y=20;
   z=30;
   avg=(x+y+z)/3;
   printf("Average of x, y and z is: %lf\n",avg);

    return 0;
}			
Problem 9: Bangladesh

Print “Bangladesh” without quotation sign by using ascii values.

[Use the given ascii values- B=66, a=97, n=110, g=103, l=108, a=97, d=100, e=101, s=115, h=104.]

Code: 
 

    #include<stdio.h> 
 
int main()
{

    printf("%c%c%c%c%c%c%c%c%c%c\n",66,97,110,103,108,97,100,101,115,104);


    return 0;
}
			
Problem 10: Precession

Rahul got 65.00 on physics, 83.50 on mathematics, 85.75 on C programming and 67.50 on English. Now write a program to calculate the average of his marks on 4 subjects and print it up to 2 digit after the decimal point. [The result should look like: XX.XX]

Code: 
 

    #include<stdio.h> 
 
int main()
{

   double marksInPhysics,marksInMath,marksInC,marksInEng,avarage;

   marksInPhysics = 65.00;
   marksInMath = 83.50;
   marksInC = 85.50;
   marksInEng = 67.50;
   avarage=(marksInPhysics + marksInMath + marksInC + marksInEng)/4;

   printf("%.2lf\n",avarage);

    return 0;
}			
Problem 11: Area Of Circle

You are given the radius of a circle, r = 5.5. We know that, pi=3.1416. Now write a program to calculate the area of the given circle and print it up to 2 digit after the decimal point. [The result should look like: XX.XX]

Code: 
 

    #include<stdio.h> 
 
int main()
{

    double r=5.5;
    double pi=3.1416;
    double area=pi*r*r;

    printf("%.2lf\n",area);

    return 0;
}			
Problem 12: Output

Take two integer variables i = 0 and j = 0. Now write the output of the following program without running the code.

int main()

int i = 0;

int j = 0;

j = i++ + ++i;

printf(“%d %d”,i,j);

}

Code: 
 

    #include<stdio.h>

int main(){
	int i = 0;
	int j = 0;
	j = i++ + ++i;
    printf("%d %d",i,j);//Output : 2 2

    return 0;
}