Showing posts with label C Programming Course. Show all posts
Showing posts with label C Programming Course. Show all posts

Friday, August 04, 2017

Challenge -3

টেস্ট কেইস কি ?

টেস্ট কেইস দ্বারা বোঝানো হয় যে, তোমার প্রোগ্রামটি ঠিক কত বার চালানো হবে। ব্যাপারটা আরো পরিষ্কার করে বলি।

ধরো, তোমাকে বলা হলো এমন একটি প্রোগ্রাম বানাতে , যেখানে তোমাকে দুটি সংখ্যার যোগফল বের করতে হবে । কিন্তু তোমাকে বলা হলো যে এভাবে প্রোগ্রামটিতে পাঁচ জোড়া সংখ্যা দেওয়া হবে এবং প্রত্যেক জোড়ার যোগফল একে একে প্রিন্ট করতে হবে । সেক্ষেত্রে আমারা টেস্ট কেইস ব্যবহার করে থাকি ।

এটি, সাধারণ একটি 'ফর লুপ' । প্রথমত একটি সংখ্যা ইনপুট নিতে হবে যা দ্বারা বোঝানো হয় যে প্রোগ্রামটি মোট তত বার চলবে। তারপর ১ থেকে সেই সংখ্যা পর্যন্ত একটি লুপ চালানো হয় ।

যেমনঃ

.
.
int main()
{
    scanf("%d",&t);
    for( i =1; i<=t ; i++ )
    {
         //you_code
     }
}
.
.


শিখে নিলে টেস্ট কেইস।
এবারে নিচের সমস্যাটি সমাধান কর ।
#Problem setter : MC Rudra

Friday, April 28, 2017

C Programming Course - 01


How to print?


Today we will learn how to print a program in C language. At first of the code , we have to write a header file. 

#include<stdio.h>

    here 'stdio' means 'Standers Input and Output. And ' .h ' says that it is a header file.
After that, we've to write,

int main()

     that means , from here the main program is going to be started. Then just write a second bracket and there write your program. 

Monday, April 03, 2017

Some essential functions of C & C++(সি এবং সি++ এর প্রয়োজনীয় ফাংশনসমূহ (বর্ণনা সহ))

সি এবং সি++ এর প্রয়োজনীয় ফাংশনসমূহ (বর্ণনা সহ)
  Function     Description
abs,labs,llabs     computes absolute value of an integer value
fabs     computes absolute value of a floating point value
div,ldiv,lldiv     computes the quotient and remainder of integer division
fmod     remainder of the floating point division operation
remainder     signed remainder of the division operation
remquo     signed remainder as well as the three last bits of the division operation
fma     fused multiply-add operation
fmax     larger of two floating point values
fmin     smaller of two floating point values
fdim     positive difference of two floating point values

nan,nanf,nanl     returns a not-a-number (NaN)

Sunday, April 02, 2017

Fibonacci

Finding the sum of Fibonacci 
&& 
The series of Fibonacci 

soliution::

#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int f[100000],i,T,j,a;

    scanf("%lld", &T);
    for(i=1; i<=T; i++)
    {
        scanf("%lld %lld", &f[0], &f[1]);
        for(j=2; j<100; j++)
        {
            f[j]=f[j-1]+f[j-2];
        }
        int z,b,sum=0;
        scanf("%lld", &b);
        scanf("%lld", &a);
        for(z=b; z<=a; z++)
        {
            sum=sum+f[z-1];
            printf(" %lld\n", f[z-1]);
        }
        printf("sum : %lld\n", sum);
    }
    return 0;
}

Divisor

Divisor Problem
soliution::
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int i,a,T,j,v;
    scanf("%lld",&T);
    for(i=1; i<=T; i++)
    {
        scanf("%lld", &a);
        for(j=1; j<=sqrt(a); j++)
        {
            if(a%j==0)
            {
                v=a/j;
                if(j==1)
                {
                    printf("%lld",j);
                }
                else
                {
                    printf(" %lld",j);
                }
            }
        }
        for(j=sqrt(a); j>=1; j--)
        {
            if(a%j==0)
            {
                v=a/j;
                if(v==sqrt(a))
                {

                }
                else
                {
                    printf(" %lld",v);
                }
            }
        }
        puts("");
    }
    return 0;
}