Showing posts with label #c programming problems and solutions in bangla. Show all posts
Showing posts with label #c programming problems and solutions in bangla. Show all posts

Sunday, October 27, 2019



Programing problem : Toph-EasyProblems-Missing number






Solution : Code in C  language 

#include<stdio.h> int main() { int a,b,c,d,e,f; scanf("%d",&a); scanf("%d %d %d",&b,&c,&d); e=b+c+d; f=a-e; printf("%d",f); return 0; }


Programing problem : Toph-Easyproblem-Pie Are Squared


Given the radius of a circle, calculate and print its area.
The area of a circle can be computed using the following formula:
A = \pi r^2
For pi, you can use 3.141592653589793, or acos(-1).

Input

The input will contain one floating point number r (r < 2000).

Output

Print the area of the circle (accurate to 10-4).


Solution : Code in  C  language 


#include<stdio.h> int main(){ int r; double pi=3.141592653589793,area; scanf("%d",&r); area=pi*r*r; printf("%f",area); return 0; }




Tuesday, September 24, 2019

C Programe : print odd numbers from 1 to 50



code

//  print odd numbers
#include <stdio.h>

int main() {
int i;
printf("odd numbers between 1 to 50 (inclusive):\n");
for (i = 1; i <= 50; i++)
{
if(i%2 == 1)
{
  printf("%d ", i);
}
}
return 0;
}


sample output : 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 2 , 29, 31, 33, 35, 37, 39, 41, 43 ,                                         45,47,49  

C programe :  print even numbers from 1 to 50

pictorial presentation : 
                                      




code : 
//  print even numbers
#include <stdio.h>

int main() {
int i;
printf("Even numbers between 1 to 50 (inclusive):\n");
for (i = 1; i <= 50; i++)
{
if(i%2 == 0)
{
  printf("%d ", i);
}
}
return 0;
}

sample output : 2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50


//take input 5 numbers and sum of all even number between them

C program : Take 5 numbes input and sum of all between number between them

#include <stdio.h>
int main() {
    int total=0;
int i, numbers[5];
printf("input the first number\n: ");
    scanf("%d", &numbers[0]);
    printf("input the second number\n: ");
    scanf("%d", &numbers[1]);
    printf("input the third number\n: ");
    scanf("%d", &numbers[2]);
printf("input the fourth number\n: ");
    scanf("%d", &numbers[3]);
    printf("input the fifth number\n: ");
    scanf("%d", &numbers[4]);
for(i = 0; i < 5; i++) {
if((numbers[i]%2) != 1)
{
   total += numbers[i];
}
    }
    printf("Sum of all even values: %d", total);
return 0;
}


Monday, September 23, 2019


দুইটি বিন্দুর মধ্যে দূরত্ব নির্ণয় কররা জন্য "সি"তে লেখা একটি প্রোগাম । 

 প্রোগামটি লিখার জন্য একটি সুত্র ব্যবহার করা হয়েছে
সুত্রটি হল ঃ

// find out the distance  between two points
#include <stdio.h>
#include <math.h>
int main()
{
float x1, y1, x2, y2, gdistance;
printf("input x1: ");
scanf("%f", &x1);
printf("input y1: ");
scanf("%f", &y1);
        printf("input x2: ");
scanf("%f", &x2);
printf("nput y2: ");
scanf("%f", &y2);
gdistance = ((x2-x1)*(x2-x1))+((y2-y1)*(y2-y1));
printf("Distance between two points: %.4f", sqrt(gdistance));
printf("\n");
return 0;
}


simple output :
input x1 : 5
input x2 : 3
input y1 : 2
input y2 : 2 
distance between two points :  2.0000



Categories

About Me

My photo
I am Md Fakhrul Islam. I am a student of EEE of Daffodil International University I am expert in SEO and Graphic designing.

Contact Form

Name

Email *

Message *

Popular Posts