C programming:Simple problems for beginners By SHAHRIAR

13.8K 11 4
                                        

C programming

Simple problems for beginners

                                       By SHAHRIAR


Contents:

1.     Find the average of any three numbers.

2.     Find the bigger number of any two numbers.

3.     Find the biggest number of any three numbers.

4.     Find if the number is positive or negative.

5.     Find if the number is odd or even.

6.     Find grade (BUBT grading system).

7.     Calculate summation of the series :  1+2+3+4+……………….+n

8.     Calculate factorial of n! .

9.     Convert Celsius temperature to Fahrenheit.

10.   Convert Fahrenheit temperature to Celsius.

---------------------------------------------------------------------------------------------------------------------------------------

Problem#1:  Find the average of any three numbers.

 

#include<stdio.h>

int main()

{

int a,b,c,avg;

printf(“Input first number:”);

scanf(“%d”,&a);

printf(“Input second number:”);

scanf(“%d”,&b);

printf(“Input third number:”);

scanf(“%d”,&c);

avg=(a+b+c)/3;

printf(“Average=%d”,avg);

return 0;

}

---------------------------------------------------------------------------------------------------------------------------------------

Problem#2:  Find the bigger number of any two numbers.

 

#include<stdio.h>

int main()

{

int a,b;

printf(“Input first number:”);

scanf(“%d”,&a);

printf(“Input second number:”);

scanf(“%d”,&b);

if(a>b)

printf(“%d is bigger number.”,a);

You've reached the end of published parts.

⏰ Last updated: Sep 19, 2011 ⏰

Add this story to your Library to get notified about new parts!

C programming:Simple problems for beginners By SHAHRIARWhere stories live. Discover now