19. বফিঃ দ্রিঃ বি প্রোগ্রোমভয িভস্যো িভোধোন – বববিও প্েখমে https://www.youtube.com/amirulislamcse
৩৩. ১.২+২.৩+৩.৪+ ............................+n(n+1) ধোযোয প্মোগপর প্েখোমনোয প্রোগ্রোভ ।
#include<stdio.h>
#include<conio.h>
main(){
int a,s,n;
s=0;
printf("Enter Value of n: ");
scanf("%d",&n);
for(a=1;a<=n;a++)
{
s=s+a*(a+1);
}
printf("Sum: %d",s);
getch();
}
===============================
#include<stdio.h>
#include<conio.h>
main(){
int a,s,n;
s=0;
printf("Enter Value of n: ");
scanf("%d",&n);
a=1;
while(a<=n)
{
s=s+a*(a+1);
a++;
}
printf("Sum: %d",s);
getch();
}
===========================================
#include<stdio.h>
#include<conio.h>
main(){
int a,s,n;
s=0;
printf("Enter Value of n: ");
scanf("%d",&n);
a=1;
do{
s=s+a*(a+1);
a++;
} while(a<=n);
printf("Sum: %d",s);
getch();
}
20. বফিঃ দ্রিঃ বি প্রোগ্রোমভয িভস্যো িভোধোন – বববিও প্েখমে https://www.youtube.com/amirulislamcse
৩৪. প্িান ংখযার ফযাক্টসরো ংখযা সনর্ণয়ের প্রাগ্রাম।
#include<stdio.h>
#include<conio.h>
main(){
int n, i;
long f=1;
printf("Enter a number: ");
scanf("%d", &n);
for(i=1; i<=n; i++) {
f=f*i;
}
printf("Factorial is %ld", f);
getch();
}
====================================
#include<stdio.h>
#include<conio.h>
main(){
int n, i=1;
long f=1;
printf("Enter a number: ");
scanf("%d", &n);
while(i<=n){
f=f*i;
i++;
}
printf("Factorial is %ld", f);
getch();
}
========================================
#include<stdio.h>
#include<conio.h>
main(){
int n, i=1;
long f=1;
printf("Enter a number: ");
scanf("%d", &n);
do{
f=f*i;
i++;
}while(i<=n);
printf("Factorial is %ld", f);
getch();
}
21. বফিঃ দ্রিঃ বি প্রোগ্রোমভয িভস্যো িভোধোন – বববিও প্েখমে https://www.youtube.com/amirulislamcse
৩৫. িীয়বার্ণ প্েয়ি ইনপুি সনয়ে দুইসি ংখযার গ.া.গু সনর্ণয়ের প্রাগ্রাম সখ।
#include <stdio.h>
#include<conio.h>
main(){
int l, s, i, gcd;
printf("Enter large value: ");
scanf("%d", &l);
printf("Enter small value: ");
scanf("%d", &s);
for(i=1; i<=l || i<=s; ++i){
if(l%i==0 && s%i==0)
gcd=i;
}
printf("GCD=%d", gcd);
getch();
}
====================================
#include <stdio.h>
#include<conio.h>
main(){
int l, s, i, gcd;
printf("Enter large value: ");
scanf("%d", &l);
printf("Enter small value: ");
scanf("%d", &s);
while(l%s!=0)
{
r = l%s;
l = s;
s = r;
}
printf("GCD=%d", s);
getch();
}
========================================
#include <stdio.h>
#include<conio.h>
main(){
int l, s, i, gcd;
printf("Enter large value: ");
scanf("%d", &l);
printf("Enter small value: ");
scanf("%d", &s);
do{
r = l %s;
l = s;
s = r;
}while(l%s!=0);
printf("GCD=%d", s);
getch();
}
22. বফিঃ দ্রিঃ বি প্রোগ্রোমভয িভস্যো িভোধোন – বববিও প্েখমে https://www.youtube.com/amirulislamcse
#include<stdio.h>
#include<conio.h>
main()
{
int a,b,x;
printf("Type the two number: ");
scanf("%d %d",&a,&b);
x=(a<b)?a:b;
again:
if(a%x==0 && b%x==0)
printf("GCD of %d and %d is %d",a,b,x);
else
{
x=x-1;
goto again;
}
getch();
}
https://icttutorialforall.blogspot.com
৩৬. দুইসি পূর্ণ ংখযার .া.গু সনর্ণে ির।
#include<stdio.h>
#include<conio.h>
main(){
int a,b,i,flag=0;
printf("Type the two number:");
scanf("%d %d",&a,&b);
for(i=1;i<=a*b && flag==0;i++){
if(i%a == 0 && i%b == 0 ){
flag++;
printf("LCM is %d",i);
}
}
getch();
}
=====================================================================
#include<stdio.h>
#include<conio.h>
main()
{
int n1, n2, i, gcd, lcm;
printf("Enter two positive integers: ");
scanf("%d %d",&n1,&n2);
for(i=1; i <= n1 && i <= n2; ++i)
{
// Checks if i is factor of both integers
if(n1%i==0 && n2%i==0)
gcd = i;
}
lcm = (n1*n2)/gcd;
printf("The LCM of two numbers %d and %d is %d.", n1, n2, lcm);
}
23. বফিঃ দ্রিঃ বি প্রোগ্রোমভয িভস্যো িভোধোন – বববিও প্েখমে https://www.youtube.com/amirulislamcse
========================= গ.া.গু এবং .া.গু================
#include<stdio.h>
#include<conio.h>
main(){
int a, b, x, y, t, gcd, lcm;
printf("Enter two integersn");
scanf("%d%d", &x, &y);
a = x;
b = y;
while (b != 0) {
t = b;
b = a % b;
a = t;
}
gcd = a;
lcm = (x*y)/gcd;
printf("Greatest common divisor of %d and %d = %dn", x, y, gcd);
printf("Least common multiple of %d and %d = %dn", x, y, lcm);
}
https://icttutorialforall.blogspot.com
৩৭. িীয়বার্ণ প্েয়ি ইনপুি সনয়ে সতনসি ংখযার .া.গু সনর্ণয়ের প্রাগ্রাম সখ।
#include<stdio.h>
#include<conio.h>
main(){
int a,b,c,i,flag=0;
printf("Type the three number:");
scanf("%d %d %d",&a,&b,&c);
for(i=1;i<=a*b*c && flag==0;i++){
if(i%a == 0 && i%b == 0 && i%c == 0){
flag++;
printf("LCM is %d",i);
}
}
getch();
}
24. বফিঃ দ্রিঃ বি প্রোগ্রোমভয িভস্যো িভোধোন – বববিও প্েখমে https://www.youtube.com/amirulislamcse
৩৮ . রাইম নম্বর প্বর িরার স প্রাগ্রাম।
#include<stdio.h>
#include<conio.h>
int main()
{
int n, i;
printf("Enter a number to check if it is primen");
scanf("%d", &n);
for(i=2; i<n; i++)
{
if(n%i == 0){
printf("%d is not prime. n",n);
break;
}
}
if(i==n){
printf("%d is prime. n",n);
return 0;
}
getch();
}
https://icttutorialforall.blogspot.com
===========================================================================
#include<stdio.h>
#include<conio.h>
main(){
int n, i, s;
printf("Enter a numbern");
scanf("%d", &n);
for (i=2; i<=n-1; i++){
s=n%i;
if (s==0) {
printf("%d is not prime number",n);
break;
}
}
if (s!=0) printf("%d is prime number", n);
getch();
}
25. বফিঃ দ্রিঃ বি প্রোগ্রোমভয িভস্যো িভোধোন – বববিও প্েখমে https://www.youtube.com/amirulislamcse
৩৯. অযায়র বযবার িয়র সফয়বানাসি সসরয়জর মান সনর্ণয়ের জনয স ভাাে প্রাগ্রাম সখ।
#include<stdio.h>
#include<conio.h>
main(){
int n, i, a[100];
printf("How many fibonacci number? ");
scanf("%d",&n);
printf("Enter 1st & 2nd number : ");
scanf("%d %d", &a[1], &a[2]);
for(i=3; i<=n; i++){
a[i]=a[i-1]+a[i-2];
printf("n Fibonacci number %d", a[i]);
}
}
https://icttutorialforall.blogspot.com
৪০. goto প্েিয়মি বযবার িয়র ফযায়ক্টাসরো মান প্বর িরার স প্রাগ্রাম সখ।
#include<stdio.h>
#include<conio.h>
main(){
int a,x;
long fact=1;
start:
printf("nType the positive integer: ");
scanf("%d",&x);
if(x<0){
printf("Negative number not allowed. ");
goto start;
}
else if(x==0)
printf("Factorial=1");
else{
for(a=2;a<=x;a++)
fact=fact*a;
printf("Factorial=%ld",fact);
}
getch();
}
৪১. এিসি এিমাসিি অযায়র ৫ সি ংখযা সনয়ে উক্ত ৫সি ংখযা সরি িরার স প্রাগ্রাম সখ।
26. বফিঃ দ্রিঃ বি প্রোগ্রোমভয িভস্যো িভোধোন – বববিও প্েখমে https://www.youtube.com/amirulislamcse
#include<stdio.h>
#include<conio.h>
void main()
{
int j;
int marks[5]={11, 23, 35, 42, 36};
printf("One Dimensional Array Elementsn");
for(j=0;j<5;j++)
{
printf("%dt",marks[j]);
}
printf("n") ;
getch();
}
৪২. অযায়র বযবার িয়র n ংখযাি ংখযার প্যাগফ সনর্ণয়ের জনয স প্রাগ্রাম সখ।
#include<stdio.h>
#include<conio.h>
main(){
int a[10],i,n,s=0;
printf("How many number:");
scanf("%d",&n);
for(i=1;i<=n;++i){
printf("Type the marks: ");
scanf("%d",&a[i]);
s=s+a[i];
}
printf("SUM=%d",s);
getch();
}
৪৩. fuction বযবার িয়র ২সি ংখযা প্যাগ িরার স প্রাগ্রামি সখ।
#include <stdio.h>
#include <conio.h>
int add(int a, int b); /*function prototype*/
main(){
int a,b,sum;
printf("Type the first number: ");
scanf("%d",&a);
printf("Type the second number: ");
scanf("%d",&b);
sum = add(a,b);
printf("Sum=%dn",sum);
getch();
}
int add(int a, int b){
int add;
add=a+b;
return add;
}
৪৪. সরিাসণভ ফাংলন বযবার িয়র ফযায়ক্টাসরো মান প্বর িরার স প্রাগ্রাম সখ।
27. বফিঃ দ্রিঃ বি প্রোগ্রোমভয িভস্যো িভোধোন – বববিও প্েখমে https://www.youtube.com/amirulislamcse
#include<stdio.h>
long int factorial(int n);
main(){
int n,fac;
printf("Type the desire value :");
scanf("%d",&n);
fac = factorial(n);
printf("Factorial value is %ldn",fac);
}
long int factorial(int n){
if (n<=1)
return (1);
else
return (n*factorial(n-1));
}
ওময়ফ িোইট
https://icttutorialforall.blogspot.com/
ইউটিউফ
https://www.youtube.com/amirulislamcse