Top

C Programming

C program

C progrmming

****1.printf***
#include stdio.h
int main()
{
printf("My Name is Md. Abdul Karim");
getch();
}

****2.Single line Comment***
//Write a program that prints your name.
#include stdio.h
int main()
{
printf("My name is : Md. Abdul Karim");
getch();
}

****3.Multiple line comment***
/*
Write your name
Address and Phone Number
*/
#include stdio.h
int main()
{
printf("My name is : Md. Abdul Karim\n");
//Escape sequence used for new line
printf("Firozshah City Corp. Girls'High School.\n");
// You will get a alart sound!
printf("\a Phone Number: 01818830761");
getch();
}

****4.print Integer number***
//Print Integer number
#include stdio.h
int main()
{
int num1=10, num2=20;
printf("Number one is: %d\n",num1);
printf("Number two is: %d\n",num2);
getch();
}

****5.print integer number***
//print integer number
#include stdio.h
int main()
{
int num1=10, num2=20;
printf("Numbers are:%d, %d\n",num1,num2);
getch();
}

****6.print integer number***
#include stdio.h
int main()
{
int num1=20;
int num2=30;
printf("Number is:%d\n",num1);
printf("Number is:%d",num2);
getch();
}

****7.print two integers***
#include stdio.h
int main()
{
int num1=20,num2=30;
printf("Number is:%d\n",num1);
printf("Number is:%d",num2);
return 0;
}

****8.Take two integers***
#include stdio.h
int main()
{
int num1=20,num2=30;
printf("Number are:%d,%d",num1,num2);
return 0;
}

****9.print decimal number float,double and character***
//print decimal number and character #include stdio.h
int main()
{
float num1=10.54568;
double num2=10.2345678958743;
char ch='K';
printf("Float number is=%.1f\n",num1);
printf("Double number is=%.2f\n",num2);
printf("character is=%c\n",ch);
getch();
}

printf & scanf


#include stdio.h
int main()
{
int num;
printf("Enter number = ");
scanf("%d",&num);
printf("Your number is:%d",num);
getch();
}

****10.Take integer number from user and print***
#include stdio.h
int main()
{
int num1,num2;
printf("Enter two integers:");
scanf("%d",&num1);
scanf("%d",&num2);
printf("Numbers are:%d %d",num1,num2);
getch();
}

****11.Take integer number from user and print***
//Take and integer and print
#include stdio.h
int main()
{
int num;
printf("Please enter an integer number = ");
scanf("%d",&num);
printf("You have press=%d",num);
getch();
}

****12.Take two integers from user and print***
#include stdio.h
int main()
{
int num1,num2;
printf("Please enter 1st integer number = ");
scanf("%d",&num1);
printf("Please enter 2nd integer number = ");
scanf("%d",&num2);
printf("You have press =%d and %d\n",num1,num2);
getch();
}

****13.Take two integers***
#include stdio.h
int main()
{
int num1,num2;
printf("Enter two integers:");
scanf("%d %d",&num1,&num2);
printf("Numbers are:%d %d",num1,num2);
getch();
}

****14.Take two integers in one scanf and print***
//Take and integer and print
#include stdio.h
int main()
{
int num1,num2;
printf("Please enter two integer numbers = ");
scanf("%d %d",&num1,&num2);
printf("You have press these numbers=%d,%d\n",num1,num2);
getch();
}

****15.Take two float numbers and print***
//Take two float numbers and print
#include stdio.h
int main()
{
float num1, num2;
printf("Please enter two float numbers = ");
scanf("%f %f",&num1,&num2);
printf("You have pressed numbers are=%.2f, %.3f\n",num1,num2);
getch();
}

****16.Take an integer and a float numbers and print***
//Take an integer and a float numbers and print
#include stdio.h
int main()
{
int num1;
float num2;
printf("Please enter an integer and a float numbers = ");
scanf("%d %f",&num1,&num2);
printf("You have pressed numbers are=%d and %.2f\n",num1,num2);
getch();
}

****17.Vowel/Consonant(use if and else if)***
#include stdio.h
int main()
{
char chr;
printf("Please enter an alphabet:");
scanf("%c",&chr);
if(chr=='a')
{
printf("vowel\n");
}
else if(chr=='e')
{
printf("vowel\n");
}
else if(chr=='i')
{
printf("vowel\n");
}
else if(chr=='o')
{
printf("vowel\n");
}
else if(chr=='u')
{
printf("vowel\n");
}
else if(chr=='A')
{
printf("vowel\n");
}
else if(chr=='E')
{
printf("vowel\n");
}
else if(chr=='I')
{
printf("vowel\n");
}
else if(chr=='O')
{
printf("vowel\n");
}
else if(chr=='U')
{
printf("vowel\n");
}
else
{
printf("Consonant\n");
}
getch();
}

****18.Area of a Triangle***
#include stdio.h
main()
{
float base;
float height;
float area;
printf("Enter base: ");
scanf("%f",& base);
printf("Enter height: ");
scanf("%f",& height);
area=(base*height)/2;
printf("area is:%f",area);
getch();
}

****19.Area of a Circle***
#include stdio.h
main()
{
float pie=3.1416;
float radius;
float area;
printf("Enter radius: ");
scanf("%f",& radius);
area=pie*radius*radius;
printf("area is:%f",area);
getch();
}

****20.Avarage two numbers***
#include stdio.h
main()
{
float x;
float y;
float avg;
printf("Enter first number: ");
scanf("%f",& x);
printf("Your second number: ");
scanf("%f",& y);
avg=(x+y)/2;
printf("average is:%f",avg);
getch();
}

****21.Modulus***
#include stdio.h
int main()
{
int a=5, b=2;
int c;
c=a%b;
printf("%d",c);
getch();
}

****22.Modulus(Mathematical Operators***
#include stdio.h
int main()
{
int a, b, c;
printf("Enter first number: ");
scanf("%d",& a);
printf("Enter second number: ");
scanf("%d",& b);
c=a%b;
printf("%d",c);
getch();
}

****23.Size of int,float,double,char***
#include stdio.h
int main()
{
int i;
float f;
double d;
char c;
printf("Size of int= %d bytes\n",sizeof(i));
printf("Size of float= %d bytes\n",sizeof(f));
printf("Size of double= %d bytes\n",sizeof(d));
printf("Size of char= %d bytes\n",sizeof(c));
getch();
}

****24.Format specifier %d***
#include stdio.h
int main()
{
int num=10;
printf("Number is:%d",num);
getch();
}

****25.Format specifier***
#include stdio.h
int main()
{
char a;
int b;
float c;
double d;

a='A';
b=10;
c=2.25;
d=3.65988;

printf("Enter a character:");
scanf("%c",&a);
printf("\tChar:%c\n",a);

printf("Enter an integer number:");
scanf("%d",&b);
printf("\tint:%d\n",b);

printf("Enter a float number:");
scanf("%f",&c);
printf("\tfloat:%f\n",c);

printf("Enter an long float number:");
scanf("%lf",&d);
printf("\tdouble:%.3lf\n",d);

getch();
}

****26.float,double,char***
#include stdio.h
int main()
{
float num1=10.5;
double num2=1.7320508;
char ch='a';
printf("Float number is:%f\n",num1);
printf("Double number is:%.2lf\n",num2);
printf("character is:%c",ch);
return 0;
}

****27.Fenction One kinds of mechine(atar mill)***
#include int addFunction(int firstNumber,int secondNumber){
int result; result=firstNumber+secondNumber;
return result;
}
int main()
{
int a,b;
a=10;
b=12;
int resultNumber=addFunction(a,b);
printf("%d+%d=%d\n",a,b,resultNumber);
getch();
}

****28.Fenction One kinds of mechine(atar mill)***
#include stdio.h
int addFunction(int firstNumber,int secondNumber)
{
int result;
result=firstNumber+secondNumber;
return result;
}
int main()
{
int a,b;
a=10;
b=12;
int resultNumber=addFunction(a,b);
printf("%d+%d=%d\n",a,b,resultNumber);
getch();
}

****29.Prime number***
//Prime number
#include stdio.h
#include stdbool.h
#include math.h
bool isPrime(int num){
int sqroot=(int)sqrt((double)num);
for (int i=2; i<=sqrt; i++){
if(num%i==0){
return fasle;
}
}
return true;
}
void generatePrimes(int num){
printf("Generated prime upto=%d\n",num);
int count=0;
for(int i=2; i<=sqrt; i++){
if(isPrime(i)){
count++;
printf("%d\n"num,count,i);
}
}
printf("Total prime %d is %d ",num,count);
}
{
int userInp;
printf("Enter an integer= ");
scanf("%d",&userInp);
generatePrimes(userInp);
getch();
}

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

30.***Series ***


//1square.2square.3square.-----+n=?

//Square Number: 1square.2square.3square.-----+n=? using for loop
#include stdio.h
int main()
{
int i, n, result=1;
printf("Enter last term= ");
scanf("%d",&n);
for (i=1; i<=n; i=i++)
{
result=result*i*i;
}
printf("%d\n",result);
getch();
}

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

31.*** Factorial ***


//Factorial 1.2.3.4.5.6.7.8.9.----.n=?

//Factorial 1.2.3.4.5.6.7.8.9-----+n=? using for loop

#include stdio.h
int main()
{
int i, n, result=1;
printf("Enter last term= ");
scanf("%d",&n);
for (i=1; i<=n; i++)
{
result=result*i;
}
printf("%d\n",result);
getch();
}

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

32.*** Cube series ***


//Summation 1cube+2cube+3cube-----+n=?

//Summation 1cube+2cube+3cube-----+n=? using for loop
#include stdio.h
int main()
{
int i, n, sum=0;
printf("Enter last term= ");
scanf("%d",&n);
for (i=1; i<=n; i++)
{
sum=sum+(i*i*i);
}
printf("%d\n",sum);
getch();
}

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

34.*** Square series ***


//Summation 1square+2square+3square-----+nsquare=? using for loop

//Sumation 1square+2square+3square-----+nsquare=? using for loop

#include stdio.h
int main()
{
int i, n, sum=0;
printf("Enter last term= ");
scanf("%d",&n);
for (i=1; i<=n; i++)
{
sum=sum+i*i;
}
printf("%d\n",sum);
getch();
}

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

35.***Fractional series***


//Summation 1.5+2.5+3.5-----+n=? using while loop

//Sumation 1.5+2.5+3.5-----+n=? using for loop

#include stdio.h
int main()
{
float i, n, sum=0;
printf("Enter last term= ");
scanf("%f",&n);
for (i=1.5;i<=n; i++)
{
sum=sum+i;
}
printf("%.2f\n",sum);
getch();
}

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

36.***Series ***


//Summation 1+4+7+10-----+n=? using while loop

//Sumation 1+4+7+10-----+n=? using while loop

#include stdio.h
int main()
{
int i, n, sum;
i=1; sum=0;//initial
printf("Enter nth term= ");
scanf("%d",&n);
while (i<=n)//ending point
{ sum=sum+i;
i=i+3;//increment
}
printf("%d\n",sum);
getch();
}

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

37.***Even series ***


//Summation 2+4+6+8-----+n=? using while loop

//Sumation 2+4+6+8-----+n=? using while loop

#include stdio.h
int main()
{
int i, n, sum;
i=2;
sum=0;
printf("Enter last term= ");
scanf("%d",&n);
while (i<=n)
{
sum=sum+i;
i=i+2;
}
printf("%d\n",sum);
getch();
}

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

38.***Natural Number series***


//Summation 1+2+3+4-----+n=? using while loop



//Sumation 1+2+3+4-----+n=? using while loop

#include stdio.h
int main()
{
int i, n, sum;
i=1;
sum=0;
printf("Enter n= ");
scanf("%d",&n);
while (i<=n)
{
sum=sum+i;
i=i++;
}
printf("%d\n",sum);
getch();
}

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

39.***Natural Number series***


//Summation 1+2+3+4-----+n=?

//Sum 1+2+3+4-----+n=?

#include stdio.h
int main()
{
int i, n, sum=0;
printf("Enter n= ");
scanf("%d",&n);
for (i=1; i<=n; i=i++)
{
sum=sum+i;
printf("%d\n",i);
}
printf("%d\n",sum);
getch();
}

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

40.***Interval Progression***


//print 1, 4, 7, 10, 13-----n

//print 1, 4, 7, 10, 13-----n

#include stdio.h
int main()
{
int n,i;
printf("Enter n= ");
scanf("%d",&n);
for (i=1; i<=n; i=i+3)
{
printf("%d\n",i);
}
getch();
}

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

41.***Natural number***


//print 1-----n

//print 1-----n

#include stdio.h
int main()
{
int n,i;
printf("Enter n= ");
scanf("%d",&n);
for (i=1; i<=n; i++)
{
printf("%d\n",i);
}
getch();
}

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

42.***Even number***


//print 1-----n

//print 2, 4, 6, 8 ---- n

#include stdio.h
int main()
{
int n,i;
printf("Enter n= ");
scanf("%d",&n);
for (i=2; i<=n; i=+2)
{
printf("%d\n",i);
}
getch();
}

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

43.***Odd number***


//print 1-----n

//print 1, 3, 5, 7 ---- n
#include stdio.h
int main()
{
int n,i;
printf("Enter n= ");
scanf("%d",&n);
for (i=1; i<=n; i=+2)
{
printf("%d\n",i);
}
getch();
}

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

44.GCD and LCM

//GCD and LCM

#include stdio.h
int main()
{
int num1, num2,n1,n2,rem,gcd,lcm ;
printf("Enter two numbers= ");
scanf("%d %d\n",&num1,&num2);
n1=num1;
n2=num2;
while (n2!=0)
{
rem=n1%n2;
n1=n2;
n2=rem;
}
gcd=n1;
lcm=(num1*num2)/gcd;
printf("Prime number");
printf("gcd=%d\n",gcd);
printf("lcm=%d\n",lcm);
getch();
}

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

46.*** For Loop ***


মৌলিক সংখ্যা নির্নয়।

এলগরিদমঃ-A

1.Start
2.Input num
3.i=2, count=0
4.Is i<=num
i).Yes,is i=0, Go to setp 5
ii).No, Go to step 6
5.
i).Yes, count++, Go to setp 6
ii).No, Go back step 4
| 6.Is (count==0)
i).Yes,print prime
ii).No, print not prime
| 7.End

Flowchart-F

Start

//Oval Type
|

input

|

num

//Parallogram
|

i=2,count=0

//Rectangular
|

Condition

i<=num

False,--------------if count==0;

True, Go to second step

|

num%i==0;
//Diamond type
|

In body fact=fact*i

//Rectangular
|

Increment

i=i+1

//Rectangular
|

True, Go to body

False, Print fact and Go to Exit

//Diamond type
|

END

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

Identify Prime number

//Identify Prime number
#include
int main()
{
int i,num, count=0;
printf("Enter any Positive Integer= ");
scanf("%d\n",&num);
for (i=2; i<=num-1; i++)
{ if (num%i==0)
{
count++;
break;
}
}
if (count==0)
{
printf("Prime number");
}
else
{
printf("Is not Prime number");
}
getch();
}

47.*** For Loop ***


ধনাত্মক পূর্নসংখ্যার ফ্যাক্টোরিয়াল নির্নয়।

এলগরিদমঃ-A

1.Start
2.Input n
3.fact=1, i=1
4.while i<=n
Repeat step 5
5.Update fact=fact*i
i=i+1
6.print fact
7.End

Flowchart-F

Start

//Oval Type
|

input

|

n

//Parallogram
|

i=1,fact=1

//Rectangular
|

Condition

i<=n

True, Go to body

False, Print fact and Go to Exit

//Diamond type
|

In body fact=fact*i

//Rectangular
|

Increment

i=i+1

//Rectangular
|

True, Go to body

False, Print fact and Go to Exit

//Diamond type
|

END

48.*** do while loop ***


Print 1-100 integer do while Loop


//Print 1-100 integer do while Loop
#include stdio.h
int main()
{
int i;
//declearation;
i=1;
//Initialization;
do {
printf("%d\n",i);
i++;
//Increment/Update;
}
while (i<=100);
//Condition; getch();
}

49.*** While loop ***


print 1-100 using while Loop


// print 1-100 using while Loop
#include stdio.h
int main()
{
int i;
//declearation;
i=1;
//Initialization;
while(i<=100)
//Condition;
{
printf("%d\n",i);
i++;
//Increment/Update; }
getch();
}

50.*** For loop ***


print 1-100 using For Loop


// print 1-100 using For Loop
#include stdio.h
int main()
{
int i;
for(i=1; i<=100; i=i+1)
//Initialization; Condition; Increment/Update
{ printf("%d\n",i);
} getch();
}

51.*** For Loop ***


Factiorial of positive integer uning Loop


// Factiorial of positive integer uning Loop
#include stdio.h
int main()
{
int i, fact=1, n;
printf("Enter a positive integer number= ");
scanf("%d",&n);
for(i=1; i<=n; i++)
{
fact=fact*i;
}
printf("%d\n",fact);
getch();
}

print Hello Bangladesh 10 times using For Loop


52.*** For loop ***


// print Hello Bangladesh 10 times using For Loop
#include stdio.h
int main()
{
int i;
for(i=1; i<=10; i++)
{
printf("Hello Bangladesh!\n");
}
getch();
}

53.*** Switch ***


0-1 Digit Spelling

এলগরিদমঃ-A

1.Start
2.input expression
3.switch(expression)
4.case condition:
5.-------
6.--------
7.break;
i)Yes, print Spelling of digit
ii)No, go to another case:
8.case condition:
9.-------
10.--------
11.break;
i)Yes, print Spelling of digit
ii)No, go to default and print not any Digit
12.End

Flowchart-F

Start

//Oval Type
|

input

|

digit

//Parallogram
|

case 0:

switch(variable)

is switch(variable)=1st case

Yes, print digit Spelling

No, Go to 2nd case:

//Diamond type
|

case 1:

switch(variable)

is switch(variable)=2nd case

Yes, print digit Spelling

No, Go to 2nd case:

//Diamond type
|

case 2:

switch(variable)

is switch(variable)=2nd case

Yes, print digit Spelling

No, Go to 3rd case:

//Diamond type
|

case 2:

switch(variable)

is switch(variable)=2nd case

Yes, print digit Spelling

//Diamond type
|

END

70.*** Switch ***


0-9 Digit Spelling


// 0-9 Digit Spelling
#include stdio.h
int main()
{
int digit;
printf("Enter any digit= ");
scanf("%d",&digit);
switch(digit)
{
case 0:
printf("Zero\n");
break;
case 1:
printf("One\n");
break;
case 2:
printf("Two\n");
break;
case 3:
printf("Three\n");
break;
case 4:
printf("Four\n");
break;
case 5:
printf("Five\n");
break;
case 6:
printf("Six\n");
break;
case 7:
printf("Seven\n");
break;
case 8:
printf("Eight\n");
break;
case 9:
printf("Nine\n");
break;
default:
printf("Is not any digit\n");
}
getch();
}

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

54.*** Switch ***


0-9 Digit Spelling


// 0-9 Digit Spelling
#include stdio.h
int main()
{
int digit;
printf("Enter any digit= ");
scanf("%d",&digit);
switch(digit)
{
case 0:
printf("Zero\n");
break;
case 1:
printf("One\n");
break;
case 2:
printf("Two\n");
break;
case 3:
printf("Three\n");
break;
case 4:
printf("Four\n");
break;
case 5:
printf("Five\n");
break;
case 6:
printf("Six\n");
break;
case 7:
printf("Seven\n");
break;
case 8:
printf("Eight\n");
break;
case 9:
printf("Nine\n");
break;
default:
printf("Is not any digit\n");
}
getch();
}

55.*** Switch ***


Vowel or Consonant using switch


// Vowel or Consonant using switch
#include stdio.h
int main()
{
char ch;
printf("Enter any alphabet= ");
scanf("%c",&ch);
switch(ch)
{
case'a':
case'e':
case'i':
case'o':
case'u':
case'A':
case'E':
case'I':
case'O':
case'U':
printf("Vowel\n");
break;
default:
printf("Consonant\n");
}
getch();
}

------------------------------------------- //

56.Switch

#include stdio.h
int main()
{
int counter,usernumber;
printf("Enter any positive number= ");
scanf("%d",&usernumber);
switch(usernumber)
{
case 1:
printf("You are 1 years Old");
break;
case 2:
printf("You are 2 years Old");
break;
case 3:
printf("You are 3 years Old");
break;
case 4:
printf("You are 4 years Old");
break;
case 5:
printf("You are 5 years Old");
break;
case 6:
printf("You are 6 years Old");
break;
case 7:
printf("You are 7 years Old");
break;
case 8:
printf("You are 8 years Old");
break;
case 9:
printf("You are 9 years Old");
break;
case 10:
printf("You are 10 years Old");
break;
default: printf("You are up to 10 years old");
}
getch();
}
----------------------------------------------- //

57.do while loop

#include stdio.h
int main()
{
int counter;
//declearation;
counter=1;
//Initialization;
do
{
printf("counter= %d\n",counter);
counter++;
//Increment/Update;
}
while (counter<=10);
//Condition; getch();
getch();
}

-------------------------------------- //

58. for loop using break

#include
int main()
{
int counter,usernumber;
usernumber=45;
for(counter=0;counter<=200;counter++)
{
if(counter==usernumber)
{
break;
}
printf("counter=%d\n",counter);
}
getch();
}

--------------------------------- //

59.Logic using for loop

#include int main()
{
int counter,usernumber;
usernumber=45;
for(counter=1;counter<=20;counter++)
{
if(counter==usernumber)

{ break;
}
printf("counter=%d\n",counter);
}
getch();
}

--------------------------------- //

60.for loop using continue

#include stdio.h
int main()
{
int counter;
for(counter=1;counter<=20;counter++)
{
if(counter==10)
{
continue;
}
printf("counter=%d\n",counter);
}
getch();
}

------------------------------------- //

61.Logic using for loop

#include stdio.h
int main()
{
int counter;
for(counter=1;counter<=20;counter*=2)
{
printf("counter=%d\n",counter);
}
getch(); }

-------------------------------------- //

62.Logic

#include stdio.h
int main()
{
int counter=1;
do{
printf("counter is %d\n",counter);
counter *=2;
}
while(counter<=20);
getch();
}

--------------------------------------- //

63.Logic

#include stdio.h
int main()
{
int counter=30;
do
{
printf("counter is %d\n",counter);
counter *=2;
}
while(counter<=20);
getch();
}

------------------------------------ //

64.Logic

#include stdio.h
int main()
{
int counter=1;
while(counter<=20)
{
printf("counter is=%d\n",counter);
counter *=2;
}
getch();
}

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

65.Logic

#include stdio.h
int main()
{
int counter=1;
while(counter<=20)
{
printf("counter is=%d\n",counter*=2);
}
getch();
}

------------------------------------------------ //

66.Logic

#include stdio.h
int main()
{
int counter=5;
while(counter<=10)
{
printf("counter is=%d\n",counter);
counter ++;
}
getch();
}
----------------------------------------------- //

67.do while loop

#include stdio.h
int main()
{
int counter;
//declearation;
counter=0;
//Initialization;
do
{
printf("counter= %d\n",counter);
counter++;
//Increment/Update;
}
while (counter<=10);
//Condition; getch();
getch();
}

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

68.While loop

#include stdio.h
int main()
{
int counter;
counter=0;//initial
while(counter<=10)//condition
{
printf("Counter is less than %d\n",counter);
counter++;//increment
}
getch();
}

---------------------------------------------- //

69.Logic

#include stdio.h
int main()
{
int a;
printf("Enter any integer= ");
scanf("%d",&a);
if(a<=50-1)
{
printf("%d is less than 50\n",a);
}
else if(a==50)
{
printf("%d is eqial to 50\n",a);
}
else
{
printf("%d is Greater than 50\n",a);
}
getch();
}

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

70.Logic

#include stdio.h
int main()
{
int a=75;
if(a<=50-1)
{
printf("a is less than 50");
}else{
if(a==50){ printf("%d"is eqial to 50): } printf("a is smaller than 50");
}
getch();
}

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

71.*** OR ***


কোন অক্ষর স্বরবর্ণ না ব্যাঞ্জন বর্ণ তা নির্নয়।

এলগরিদমঃ-A

1.Start
2.input ch
3.Is ch=='a' or ch=='A'
3.Is ch=='e' or ch=='E'
3.Is ch=='i' or ch=='I'
3.Is ch=='o' or ch=='O'
3.Is ch=='u' or ch=='U'
i)Yes, print vowel
ii)No, print Consonant
4.Is ch>='a' && ch<='z'

i)Yes, print Small Letter
ii)No, print Not any Letter
5.End

Flowchart-F

Start

//Oval Type
|

input

|

ch

//Parallogram
|

Is ch>='A' Or ch<='Z'

Is ch=='a' or ch=='A'

Is ch=='e' or ch=='E'

Is ch=='i' or ch=='I'

Is ch=='o' or ch=='O'

Is ch=='u' or ch=='U'

//Diamond type
|

Yes, Vowel Letter

No, Consonant Letter

//Right corner parallogram and connect end
|

END

Cprogram-C

#include stdio.h
int main()
{
char ch;
printf("Please enter an alphabet:");
scanf("%c",&ch);
if(ch=='a'||ch=='A'||ch=='e'||ch=='E'||ch=='i'||ch=='I'||ch=='o'||ch=='O'||ch=='u'||ch=='U')
printf("%c is vowel\n",ch);
else
printf("%c is Consonant\n",ch);
getch();
}

//Identify Vowel or Consonant Letter
#include stdio.h
int main()
{
char chr;
printf("Please enter an alphabet:");
scanf("%c",&chr);
if(chr=='a')
printf("vowel\n");
else if(chr=='e')
printf("vowel\n");
else if(chr=='i')
printf("vowel\n");
else if(chr=='o')
printf("vowel\n");
else if(chr=='u')
printf("vowel\n");
else if(chr=='A')
printf("vowel\n");
else if(chr=='E')
printf("vowel\n");
else if(chr=='I')
printf("vowel\n");
else if(chr=='O')
printf("vowel\n");
else if(chr=='U')
printf("vowel\n");
else
printf("Consonant\n");
getch();
}

72.*** *** ***


কোন অক্ষর ছোট হাতের না বড় হাতের না কোন অক্ষর নয় তা নির্নয়।

এলগরিদমঃ-A

1.Start
2.input ch
3.Is ch>='A' and ch<='Z'
i)Yes, print Capital Letter
ii)No, Go to next step
4.Is ch>='a' && ch<='z'

i)Yes, print Small Letter
ii)No, print Not any Letter
5.End

Flowchart-F

Start

//Oval Type
|

input

|

ch

//Parallogram
|

Is ch>='A' && ch<='Z'

//Diamond type
|

Yes, Capital Letter

//Right corner parallogram and connect end
|

No, connect another Diamond

|

Is ch>='a' && ch<='z'

//Diamond type
|

Yes, print Small letter

//Right corner parallogram and connect end
|

No, print Not any Letter

|

END

73.*** AND ***


Cprogram-C

//Identify Small or Capital Letter
#include stdio.h
int main()
{
char ch ;
printf("Enter any Letter= ");
scanf("%c",&ch );
if(ch>='A' && ch<='Z')
printf("%c is Capital Letter",ch);
else if(ch>='a' && ch<='z')
printf("%c is Small Letter",ch);
else
printf("%c is not any Letter",ch);
getch();
}

73.*** AND ***


কোন সন লিপইয়ার কি না তা নির্নয়।

এলগরিদমঃ-A

1.Start
2.input Year
3.Is year%400==0
i)Yes, print leapyear
ii)No, Go to next step
4.Is year%4==0 && year%100!==0
i)Yes, print leapyear
ii)No, print not leapyear
5.End

Flowchart-F

Start

//Oval Type
|

input

|

year

//Parallogram
|

Is year%400==0

//Diamond type
|

Yes, print leapyear

//Right corner parallogram and connect end
|

No, connect another Diamond

|

Is year%4==0 && year%100!==0

//Diamond type
|

Yes, print leapyear

//Right corner parallogram and connect end
|

No, print Not leapyear

|

END

Cprogram-C

//Identify leapyear
#include stdio.h
int main()
{
int year;
printf("Enter year= ");
scanf("%d",&year);
if(year%400==0)
printf("%d is leapyear!",year);
else if(year%4==0 && year%100!=0)
printf("%d is leapyear!",year);
else
printf("%d is not leapyear",year);
getch();
}

74.*** > ***


দুটি সংখ্যার মধ্যে বড় সংখ্যা নির্নয়।

এলগরিদমঃ-A

1.Start
2.input num1 num2, num3
3.Is num1 > num2 and num1>num3
i)Yes, print num1 is greatest
ii)No, Go to next step
4.Is num2 > num1 and num2>num3
i)Yes, print num2 is greatest
ii)No, Go to next step
5.Is num3 > num1 and num3>num2
i)Yes, print num3 is greatest
ii)No, print These are equal
6.End

Flowchart-F

Start

//Oval Type
|

input

|

num1, num2, num3

//Parallogram
|

Is num1 > num2 && num1>num3

//Diamond type
|

Yes, print num1 is Greatest number

//Right corner parallogram and connect end
|

No, connect another Diamond

|

Is num2 > num1 && num2>num3

//Diamond type
|

Yes, print num2 is Greatest number

//Right corner parallogram and connect end
|

No, connect another Diamond

|

Is num3 > num1 && num3>num2

//Diamond type
|

Yes, print num3 is Greatest number

//Right corner parallogram and connect end
|

No, print All are Equal

|

END

Cprogram-C

//Identify greatest number
#include stdio.h
int main()
{
int num1, num2,num3;
printf("Enter 1st number= ");
scanf("%d",&num1);
printf("Enter 2nd number= ");
scanf("%d",&num2);
printf("Enter 3rd number= ");
scanf("%d",&num3);
if(num1>=num2-1&&num1>=num3-1)
printf("Largest=%d",num1);
else if(num3>=num1-1&&num3>=num2-1)
printf("Largest=%d",num3);
else
printf("All are equal");
getch();
}

75.*** > ***


দুটি সংখ্যার মধ্যে বড় সংখ্যা নির্নয়।

এলগরিদমঃ-A

1.Start
2.input num1 num2
3.Is num1 > num2
i)Yes, print num1
ii)No, Go to next step
4.Is num2 < mum1
i)Yes, print num2
ii)No,print Equal
5.End

Flowchart-F

Start

//Oval Type
|

input

|

num1, num2

//Parallogram
|

Is num1 > num2

//Diamond type
|

Yes, print num1

//Right corner parallogram and connect end
|

No, connect another Diamond

|

Is num2 > num1

//Diamond type
|

Yes, print num2

//Right corner parallogram and connect end
|

No, print Both Equal

//Bottom corner of Diamond and connect end
|

END

Cprogram-C

//Identify greater number between two
#include stdio.h
int main()
{
int num1, num2;
printf("Enter 1st number= ");
scanf("%d",&num1);
printf("Enter 2nd number= ");
scanf("%d",&num2);
if(num1>=num2+1)
printf("1st number is greater than 2nd number");
else if(num2>=num1+1)
printf("2nd number is greater than 1st number");
else
printf("Both numbers are equal.");
getch();
}

//Identify greater number
#include stdio.h
int main()
{
int num1, num2;
printf("Enter 1st number= ");
scanf("%d",&num1);
printf("Enter 2nd number= ");
scanf("%d",&num2);
if(num1>=num2+1)
printf("Large=%d",num1);
else if(num2>=num1+1)
printf("Large=%d",num2);
else
printf("Both numbers are equal");
getch();
}

//Identify smaller number
#include stdio.h
int main()
{
int num1, num2;
printf("Enter 1st number= ");
scanf("%d",&num1);
printf("Enter 2nd number= ");
scanf("%d",&num2);
if(num1 <= num2-1)
printf("Smaller=%d",num1);
else if(num2 <= num1-1)
printf("Smaller=%d",num2);
else
printf("Both numbers are equal");
getch();
}

76.*** *** ***


ধনাত্মক, ঋনাত্মক অথবা শুন্য নির্নয়।

এলগরিদমঃ-A

1.Start
2.input num
3.Is num > 0
i)Yes, print Positive
ii)No, Go to next step
4.Is num < 0
i)Yes, print Negative
ii)No, print Zero
5.End

Flowchart-F

Start

//Oval Type
|

input

|

num

//Parallogram
|

Is num > 0

//Diamond type
|

Yes, print Positive number

//Right corner parallogram and connect end
|

No, connect another Diamond

|

Yes, print Negative number

//Right corner parallogram and connect end
|

No, print Zero

//Bottom corner of Diamond and connect end
|

END

Cprogram-C

//Condition Positive number,Negative number or zero
#include stdio.h
int main()
{
int num;
printf("Enter any number= ");
scanf("%d",&num);
if(num >=0+1)
printf("You press positive number\n");
else if(num <= 0-1)
printf("You press Negative number\n");
else
printf("You press zero\n");
getch();
}

70.*** *** ***


Cprogram-C

//Condition Positive number,Negative number or zero
#include stdio.h
int main()
{
int num;
printf("Enter any number= ");
scanf("%d",&num);
if(num >= 0-1)
{
printf("You press positive number\n");
}
else if(num <= 0-1)
{
printf("You press Negative number\n");
}
else
printf("You press zero\n");
getch();
}

70.*** *** ***


Condition positive number number


//Condition positive number number
#include stdio.h
int main()
{
int x;
printf("Enter any number= ");
scanf("%d",&x);
if(x>=0+1)
{
printf("You press positive number\n");
}
else
printf("You press Negative number\n");
getch();
}

77.*** *** ***


Condition(positive number)


#include stdio.h
int main()
{
int x=5;
if(x>=0)
{
printf("x is positive\n");
} getch();
}

78.*** *** ***


জোড় অথবা বিজোড় নির্নয়।

এলগরিদমঃ-A

1.Start
2.input num
3.Is num % 2== 0
i)Yes, print Even
ii)No, Print Odd
4.End

Flowchart-F

Start

//Oval Type |

input

|

num

//Parallogram
|

Is num % 2== 0

//Parl type
|

Yes, print Even connect end

//Right corner parallogram
|

No, Print Odd and connect end

//Bottom corner parallogram
|

END

Cprogram-C

//Condition even or odd number
#include stdio.h
int main()
{
int num;
printf("Enter any integer= ");
scanf("%d",&num);
if(num%2==0)
{
printf("You press even number.\n");
}
else
{
printf("You press odd number.\n");
}
getch();
}

79.*** *** ***


Condition even or odd number


//Condition even or odd number
#include stdio.h
int main()
{
int x;
printf("Enter any integer= ");
scanf("%d",&x);
if(x%2==0)
{
printf("You press even number.\n");
}
else
{
printf("You press odd number.\n");
}
getch();
}

80.*** *** ***


Condition(Odd number)


#include stdio.h
int main()
{
int x=11;
int y=x%2;
if(y==0)
{
printf("x is even\n");
}
else{
printf("x is Odd\n");
}
getch();
}

81.*** *** ***


Condition(even number)


#include stdio.h
int main()
{
int x=10;
int y=x%2;
if(y==0)
{
printf("x is even\n");
}
return 0;
}

82.*** *** ***


Condition(even number)


#include stdio.h
int main()
{
int x=2;
if(x%2==0)
{
printf("x is even\n");
}
getch();
}

83.*** *** ***


Power value


//Power value
#include stdio.h
int main()
{
int x,y;
printf("Enter x= ");
scanf("%d",&x);
printf("Enter y= ");
scanf("%d",&y);
double result=pow(x,y);
printf("Power value= %.2lf\n",result);
getch();
}

84.*** *** ***


Power value


//Power value
#include stdio.h
int main()
{
float base, power,result;
printf("Enter base= ");
scanf("%f",&base);
printf("Enter power= ");
scanf("%f",&power);
result=pow(base,power);
printf("Power value= %.2lf\n",result);
getch();
}

85.*** *** ***


Power value


//Power value
#include
int main()
{
double result=pow(5,2);
printf("Power value= %.2lf\n",result);
getch();
}

86.*** *** ***


Square root value


//Square root value
#include stdio.h
int main()
{
int x;
double result;
printf("Enter a positive number= ");
scanf("%d",&x);
result=sqrt(x);
printf("Squre root value= %.3f\n",result);
getch();
}

87.*** *** ***


Square root value


//Square root value
#include stdio.h
int main()
{
float value,result;
printf("Enter a positive integer or fraction number= ");
scanf("%f",&value);
result=sqrt(value);
printf("Squre root value= %.3f\n",result);
getch();
}

88.*** *** ***


Square root value


//Square root value
#include stdio.h
int main()
{
float value,result;
printf("Enter a positive integer or fraction number= ");
scanf("%f",&value);
result=sqrt(value);
printf("Squre root value= %f\n",result);
getch();
}

89.*** *** ***


Absolute value


//Absolute value
#include stdio.h
int main()
{
int value,result;
printf("Enter a positive or negative number= ");
scanf("%d",&value);
result=abs(value);
printf("Absolute value= %d\n",result);
getch();
}

90.*** *** ***


Absolute value


//Absolute value
#include stdio.h
int main()
{
int result=abs(-7);
printf("Absolute value= %d\n",result);
getch();
}

91.*** *** ***


ফারেনহাইট স্কেলের তাপমাত্রা কে সেন্টিগ্রেডে এ রূপান্তর

এলগরিদমঃ-A

১। শুরু
২। ফারেনহাইট স্কেলের তাপমাত্রা f নিই।
৩। c=(f - 32)*5/9 । সূত্র ব্যবহার করে সেন্টিগ্রেড স্কেলের তাপমাত্রা c নির্নয় করি।
৪। সেন্টিগ্রেড স্কেলের তাপমাত্রা প্রদর্শন করি।
৫। শেষ।

Flowchart-F

Start

|

input

|

f

|

c=(f - 32)*5/9

|

Print c

|

End

Cprogram-C

//Convert Farenhite temperatuer to Centigrade
#include stdio.h
int main()
{
float c,f;
printf("Enter temperature in Ferenhite scale= ");
scanf("%f",&f);
c=(f - 32)*5/9;
printf("Tenperature of Centigrade Scale=%.2f",c);
getch();
}

97.*** *** ***


সেন্টিগ্রেড স্কেলের তাপমাত্রা কে ফারেনহাইট এ রূপান্তর

এলগরিদমঃ-A

১। শুরু
২। সেন্টিগ্রেড স্কেলের তাপমাত্রা c নিই।
৩। f=(c * 1.8)+32 । সূত্র ব্যবহার করে ফারেনহাইট স্কেলের তাপমাত্রা f নির্নয় করি।
৪। ফারেনহাইট স্কেলের তাপমাত্রা প্রদর্শন করি।
৫। শেষ।

Flowchart-F

Start

|

input

|

c

|

f=(c* 1.8)+32

|

Print f

|

End

Cprogram-C

//Convert Celcius temperatuer to Ferenhite
#include stdio.h
int main()
{
float c,f;
printf("Enter temperature in centigrade scale= ");
scanf("%f",&c);
f = (c * 1.8)+32;
printf("Tenperature of Ferenhite Scale=%.2f",f);
getch();
}

92.*** *** ***


বৃত্তের পরিধি নির্নয়।

এলগরিদমঃ-A

১। শুরু
২। ব্যাসার্ধ r নিই।
৩। বৃত্তের পরিধি= ২ * 3.1416 * r । সূত্র ব্যবহার করে বৃত্তের পরিধি নির্নয় করি।
৪। পরিথি প্রদর্শন করি।
৫। শেষ।

Flowchart-F

Start

|

input

|

radius

|

perimeter= 2 * 3.1416 * radius

|

Print perimeter

|

End

Cprogram-C

#include stdio.h
#include math.h
int main()
{
float radius,perimeter;
printf("Enter radius= ");
scanf("%f",&radius);
perimeter = 2 * M_PI * radius;
printf("Perimeter of Circle=%.2f",perimeter);
getch();
}

Cprogram-C

//Area of a Circle
#include stdio.h
int main()
{
float radius,area;
printf("Enter radius= ");
scanf("%f",&radius);
area=3.1416 * radius * radius;
printf("Area of Circle=%.2f",area);
getch();
}

Cprogram-C

//Area of a Circle
#include stdio.h
int main()
{
float radius,area,pi=3.1416;
printf("Enter radius= ");
scanf("%f",&radius);
area=pi * radius * radius;
printf("Area of Circle=%.2f",area);
getch();
}

95.*** *** ***


আয়তক্ষেত্রের ক্ষেত্রফল নির্নয়।

এলগরিদমঃ-A

১। শুরু
২। দৈর্ঘ্য ও প্রস্থ নিই।
৩। ক্ষেত্রফল=দৈর্ঘ্য * প্রস্থ । সূত্র ব্যবহার করে ক্ষেত্রফল নির্নয় করি।
৪। ক্ষেত্রফল প্রদর্শন করি।
৫। শেষ।

Flowchart-F

Start

|

Input

|

length,width

|

area=length * width

|

Print area

|

End

Cprogram-C

93. //Area of a rectangle
#include stdio.h
int main()
{
float length,width,area;
printf("Enter lingth= ");
scanf("%f",&length);
printf("Enter width= ");
scanf("%f",&width);
area=length * width;
printf("Area of rectangale=%.2f\n",area);
getch();
}

-------------------------------------------------- //

94.Triangle area using Function

#include
double triangleArea(double b, double h);
int main()
{
double base, height;
printf("Enter base= ");
scanf("%lf",&base);
printf("Enter height= ");
scanf("%lf",&height);
double area=triangleArea(base,height);
printf("area= %.2f\n",area);
}
double triangleArea(double b, double h)
{
return 0.5*b*h;
}

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

95.***Area of a triangle ***


//Area of a triangle

//Area of a triangle
#include stdio.h
int main()
{
double base, height;
printf("Enter base= ");
scanf("%lf",&base);
printf("Enter height= ");
scanf("%lf",&height);
double area=0.5*base*height;
printf("area%.2f\n",area);
getch();
}

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

96.*** *** ***


ত্রিভূজের তিনটি বাহুর দৈর্ঘ্য থেকে ক্ষেত্রফল নির্নয়।

এলগরিদমঃ-A

১। শুরু
২। তিনটি বাহুর দৈর্ঘ্য নিই।
৩। পরিসীমার অর্ধ s=(a+b+c)/2 নির্নয় করি।
৪। area= sqrt(s(s-a)(s-b)(s-c)) সূত্র ব্যবহার করে ক্ষেত্রফল নির্নয় করি।
৫। ক্ষেত্রফল প্রদর্শন করি।
৬। শেষ।

Flowchart-F

Start

|

Input

|

base,height,area

|

area=(base*height)/2

|

Print area

|

End

Cprogram-C

//Area of a triangle given length of three arms
#include stdio.h

main()
{
float a,b,c,s,area;
printf("Enter length of 1st arm: ");
scanf("%f",&a);
printf("Enter length of 2nd arm: ");
scanf("%f",&b);
printf("Enter length of 3rd arm: ");
scanf("%f",&c);
s=(a+b+c)/2;
area=sqrt(s*(s-a)*(s-b)*(s-c));
printf("area is:%.2f",area);
getch();
}

97.*** *** ***


ত্রিভূজের ক্ষেত্রফল নির্নয়।

এলগরিদমঃ-A

১। শুরু
২। ভুমি ও উচ্চতা নিই।
৩। ক্ষেত্রফল=(ভুমি*উচ্চতা)/২ সূত্র ব্যবহার করে ক্ষেত্রফল নির্নয় করি।
৪। ক্ষেত্রফল প্রদর্শন করি।
৬। শেষ।

Flowchart-F

Start

|

Input

|

base,height,area

|

area=(base*height)/2

|

Print area

|

End

Cprogram-C

//Area of a triangle
#include stdio.h
main()
{
float base;
float height;
float area;
printf("Enter base: ");
scanf("%f",& base);
printf("Enter height: ");
scanf("%f",& height);
area=(base*height)/2;
printf("area is:%.2f",area);
getch();
}

98.*** *** ***


তিনটি পূর্ণ সংখ্যার যোগফল ও গড় নির্নয়।

এলগরিদমঃ-A

১। শুরু
২। সংখ্যা তিনটির ইনপুট নিই।
৩। সংখ্যা তিনটির যোগফল নির্নয় করি।
৪। যোগফলকে তিন দিয়ে ভাগ করে গড় নির্নয় করি।
৫। যোগফল ও গড় প্রদর্শন করি।
৬। শেষ।

Flowchart-F

Start

|

Input

|

num2,num2,num3,sum,avg

|

Sum=num1+num2+num3

|

avg=sum/3

|

Print Sum

|

Print avg

|

End

Cprogram-C

// Sum and Average of three integers
#include stdio.h
int main()
{
int num1,num2,num3,sum;
float avg;
printf("Please enter 1st integer numbers = ");
scanf("%d",&num1);
printf("Please enter 2nd integer numbers = ");
scanf("%d",&num2); printf("Please enter 3rd integer numbers = ");
scanf("%d",&num3);
sum = num1 + num2+ num3;
printf("The sum of these three numbers=%d\n",sum);
avg=(float)sum/3;
printf("The avarage of these three numbers=%.2f\n",avg);
getch();
}

99.*** *** ***


দুইটি সংখ্যার যোগফল নির্নয়।

এলগরিদমঃ-A

১। শুরু
২। দুইটি সংখ্যা ইনপুট নিই।
৩। সংখ্যা দুটি যোগ করি।
৪। যোগফল প্রদর্শন করি।
৫। শেষ।

Flowchart-F

Start

|

Input

|

num2,num2

|

Sum=num1+num2

|

Print Sum

|

End

Cprogram-C

#include stdio.h
int main()
{
int num1,num2,sum;
printf("Please enter two integer numbers = ");
scanf("%d %d",&num1,&num2);
sum = num1 + num2;
printf("The sum of these numbers are=%d\n",sum);
getch();
}

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

100.*** *** ***


Assignment Operator a%=2 means a=a%2


//Assignment Operator a%=2 means a=a%2
#include stdio.h
int main()
{
int a=5;
a%=2;
//ie, a=a%2
printf("a= %d\n",a);
//a=1
getch();
}

101.*** *** ***


Assignment Operator a%=2 means a=a%2


//Assignment Operator a%=2 means a=a%2
#include stdio.h
int main()
{
int a=5;
a%=2;
//ie, a=a%2
printf("a= %d\n",a);
//a=1
getch();
}

102.*** *** ***


Assignment Operator a-=2 means a=a-2


//Assignment Operator a-=2 means a=a-2
#include stdio.h
int main()
{
float a=5;
a-=2;
//ie, a=a-2
printf("a= %.2f\n",a);
//a=3
getch();
}

103.*** *** ***


Assignment Operator a/=2 means a=a/2


//Assignment Operator a/=2 means a=a/2
#include stdio.h
int main()
{
float a=5;
a/=2;
//ie, a=a/2
printf("a= %f\n",a);
//a=2.5
getch();
}

104.*** *** ***


Assignment Operator a*=2 means a=a*2


//Assignment Operator a*=2 means a=a*2
#include stdio.h
int main()
{
int a=5;
a*=2;
//ie, a=a*2
printf("a= %d\n",a);
//a=10
getch();
}

105.*** *** ***


Assignment Operator a+=2 means a=a+2


//Assignment Operator a+=2 means a=a+2
#include stdio.h
int main()
{
int a=5;
a+=2;
//ie, a=a+2
printf("a= %d\n",a);
//a=7
getch();
}

106.*** *** ***


Area of a triangle(Type casting)


//Area of a triangle
#include stdio.h
int main()
{
float base,height,area;
printf("Enter Base = ");
scanf("%f",&base);
printf("Enter Height = ");
scanf("%f",&height);
area=(float)1/2*base*height;
printf("Area of a triangle =%.2f\n",area);
getch();
}

107.*** *** ***


Arithmatic operators


//Arithmatic operators
#include stdio.h
int main()
{
int num1,num2,result;
printf("Please enter 1st integer numbers = ");
scanf("%d",&num1);
printf("Please enter 2nd integer numbers = ");
scanf("%d",&num2);
result= num1+num2;
printf("sum=%d\n",result);
result= num1-num2;
printf("subtract=%d\n",result);
result= num1*num2;
printf("multiplication=%d\n",result);
result= num1/num2;
printf("Division=%d\n",result);
result= num1 % num2;
printf("remainder=%d\n",result);
getch();
}

108.*** *** ***


Average between two decimal numbers (Type casting)


//Type casting
#include stdio.h
int main()
{
float num1,num2,sum;
float avg;
printf("Please enter 1st integer numbers = ");
scanf("%f",&num1);
printf("Please enter 2nd integer numbers = ");
scanf("%f",&num2);
sum= num1+num2;
avg=(float)sum/2;
//Type casting
printf("The average of two numbers is=%.2f\n",avg);
getch();
}

109.*** *** ***


Average between two decimal numbers


//Average between two decimal numbers
#include stdio.h
int main()
{
float num1,num2,sum,avg;
printf("Please enter 1st integer numbers = ");
scanf("%f",&num1);
printf("Please enter 2nd integer numbers = ");
scanf("%f",&num2);
avg=(num1+num2)/2;
printf("The average of two numbers is=%.2f\n",avg);
getch();
}

110.*** *** ***


Arithmatic operator Sum


//Arithmatic operator Sum
#include stdio.h
int main()
{
int num1,num2,sum;
printf("Please enter 1st integer numbers = ");
scanf("%d",&num1);
printf("Please enter 2nd integer numbers = ");
scanf("%d",&num2);
sum = num1 + num2;
printf("The sum of these numbers are=%d\n",sum);
getch();
}

111.*** *** ***


Arithmatic operator Sum between two integers


//Arithmatic operator Sum between two integers
#include stdio.h
int main()
{
int num1,num2,sum;
printf("Please enter 1st integer numbers = ");
scanf("%d",&num1);
printf("Please enter 2nd integer numbers = ");
scanf("%d",&num2);
sum = num1 + num2;
printf("The sum of these two numbers=%d\n",sum);
getch();
}

112.*** *** ***


Alert bel \a


//Escape sequence \n
#include
int main()
{
printf("\a Md. Abdul Karim\n");
printf("Assistant teacher: \n");
printf("Firozshah City Corp. Girls' High School\n");
printf("Akbarshah\n");
printf("Chittagong\n");
getch();
}

113.*** *** ***


Escape sequence \n


//Escape sequence \n
#include
int main()
{
printf("Md. Abdul Karim\n");
printf("Assistant teacher: \n");
printf("Firozshah City Corp. Girls' High School\n");
printf("Akbarshah\n");
printf("Chittagong\n");
getch();
}

114.*** *** ***


Convert Hexa-Decimal number to Octal


// Convert Hexa-Decimal number to Octal
#include stdio.h
main()
{
int number;
printf("Hexa-Decimal number= ");
scanf("%x",&number);
printf("Octal number=%o",number);
getch();
}

115.*** *** ***


Convert Octal number to Hexa-Decimal


// Convert Octal number to Hexa-Decimal
#include stdio.h
main()
{
int number;
printf("Octal number= ");
scanf("%o",&number);
printf("Hexa-Decimal number=%x",number);
getch();
}

116.*** *** ***


Convert Hexa-Decimal number to Decimal


// Convert Hexa-Decimal number to Decimal
#include stdio.h
main()
{
int number;
printf("Hexa-Decimal number= ");
scanf("%x",&number);
printf("Decimal number=%d",number);
getch();
}

117.*** *** ***


Convert Decimal number to Hexa-Decimal


// Convert Decimal number to Hexa-Decimal
#include stdio.h
main()
{
int number;
printf("Decimal number= ");
scanf("%d",&number);
printf("Hexa-Decimal number=%x",number);
getch();
}

118.*** *** ***


Convert Octal number to Decimal


// Convert Octal number to Decimal
#include stdio.h
main()
{
int number;
printf("Octal number= ");
scanf("%o",&number);
printf("Decimal number=%d",number);
getch();
}

119.*** *** ***


Convert Decimal number to Octal


// Convert Decimal to Octal
#include stdio.h
main()
{
int number;
printf("Decimal number= ");
scanf("%d",&number);
printf("Octal number=%o",number);
getch();
}

120.*** *** ***


Convert Character to Ascii value


//Convert to Character Ascii value
#include stdio.h
int main()
{
int n;
char ch;
printf("Enter any ASCII value : ");
//114
scanf("%d",&n);
printf("The Ascii character is:%c",n);
//r
getch();
}
}

121.*** *** ***


Convert Ascii value to Character


//Convert Ascii value to Character
#include stdio.h
int main()
{
int n;
char ch;
printf("Enter any ASCII value : ");
//122
scanf("%d",&ch);
printf("The Ascii character is:%c",ch);
//r
getch();
}

123.*** *** ***


Area of a triangle


#include stdio.h
int main()
{
float base,height,area;
printf("Enter Base = ");
scanf("%f",&base);
printf("Enter Height = ");
scanf("%f",&height);
area=0.5*base*height;
printf("Area of a triangle =%.2f\n",area);
getch();
}

****124.convert uppercase to lowercase without library function***
#include stdio.h
int main()
{
char lower,upper;
printf("Enter any uppercase letter : ");
scanf("%c",&upper);
printf("lowercase letter=%c",upper+32);
getch();
}

****125.convert lowercase to uppercase without library function***
#include stdio.h
int main()
{
char lower,upper;
printf("Enter any lowercase letter : ");
scanf("%c",&lower);
printf("Uppercase letter=%c",lower-32);
getch();
}

****126.convert uppercase to lowercase with library function***
#include stdio.h
int main()
{
char lower,upper;
printf("Enter any uppercase letter= ");
scanf("%c",&upper);
lower=tolower(upper);
printf("lowercase letter=%c",lower);
getch();
}

****127.convert lowercase to uppercase with library function***
#include stdio.h
int main()
{
char lower,upper;
printf("Enter any lowercase letter : ");
scanf("%c",&lower);
upper = toupper(lower);
printf("uppercase letter=%c", upper);
getch();
}

****128.Convert Decimal number to Octal number***
#include stdio.h
int main()
{
int number;
printf("Decimal number = ");
scanf("%d",&number );
printf("Octal number = %o",number);
getch();
}

****129.Convert Octal to Decimal number***
//Convert Octal to Decimal number
#include stdio.h
int main()
{
int number;
printf("Octal number = ");
scanf("%o",&number );
printf("Decimal number = %d",number);
getch();
}

****130.Convert Decimal to Hexa-Decimal number***
//Convert Decimal to Hexa-Decimal number
#include stdio.h
int main()
{
int number;
printf("Decimal number = ");
scanf("%d",&number );
printf("Hexa-Decimal number = %x",number);
getch();
}

****131.Convert HexaDecimal to Decimal number***
//Convert HexaDecimal to Decimal number
#include stdio.h
int main()
{
int number;
printf("Hexa-Decimal number = ");
scanf("%x",&number );
printf("Decimal number = %d",number);
getch();
}

****132.Convert Hexa-Decimal to Octal number***
//Convert Hexa-Decimal to Octal number
#include stdio.h
int main()
{
int number;
printf("Hexa-Decimal number = ");
scanf("%x",&number );
printf("Octal number = %o",number);
getch(); }

****133.Convert Octal to Hexa-Decimal number***
//Convert Octal to Hexa-Decimal number
#include stdio.h
int main()
{
int number;
printf("Octal number = ");
scanf("%o",&number );
printf("Hexa-Decimal number = %x",number);
getch();
}

134.array


#include stdio.h
int main()
{
int a,b,c;
int n[3];
int i;
for(i=0;i<=3-1;i++)
{
scanf("%d",&n[i]);
}
for(i=0;i<=3-1;i++)
{
printf("%d\n",n[i]);
}
getch();
}

135.*** *** ***


array


#include stdio.h
int main()
{
int a,b,c;
int n[3];
int i;
for(i=0;i<=3-1;++i)
{
scanf("%d",&n[i]);
}
for(i=0;i<=3-1;++i)
{
printf("%d\n",n[i]);
}
getch();
}

136.*** *** ***


array


#include stdio.h
int main()
{
int a,b,c; int n[3];
a=2;
n[0]=2;
printf("a=%d n[0]=%d\n",a,n[0]);
a=a+1;
n[0]=n[0]+1;
printf("a=%d n[0]=%d\n",a,n[0]);
getch();
}

137.*** *** ***


array


#include stdio.h
int main()
{
int a,b,c;
int n[3];
scanf("%d",&n[0]);
scanf("%d",&n[1]);
scanf("%d",&n[2]);
printf("%d\n",n[0]);
printf("%d\n",n[1]);
printf("%d\n",n[2]);
getch();
}

138.*** *** ***


scanf and printf


#include stdio.h
int main()
{
int a,b,c;
int n[3];
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
printf("%d\n",a);
printf("%d\n",b);
printf("%d\n",c);
getch();
}

139.*** *** ***


print * line by line


#include stdio.h
int main()
{
int i,j,n;
for(j=0;j<=5-1;j=j+1){
for(i=0;i<=j+1-1;i=i+1)
{
printf("*");
}
printf("\n");
getch();
}

140.*** *** ***


print * line by line


#include stdio.h
int main()
{
int i,j,n;
for(j=0;j<=5-1;j=j+1){
for(i=0;i<=j+1-1;i=i+1)
{
printf("*");
}
printf("\n");
getch();
}

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

141.print * line by line*** *** ***

#include stdio.h
int main()
{
int i,j,n;
for(j=0;j<=5-1;j=j++){
for(i=0;i<=j+1-1;i=i++)
{
printf("*");
}
printf("\n");
getch();
}

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

142.Enter starting number,difference and ending number and get sum

#include stdio.h
int main()
{
int n,sum,start,dif,end;
scanf("%d%d%d",&start,&dif,&end);
for(n=start,sum=0;n<=end;n=n+dif)
{
sum=sum+n;
}
printf("Sum is=%d\n",sum);
getch();
}

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

143.sum 5+10+15+20+25----990+995+1000*** *** ***

#include
int main()
{
int n,sum=0;
for(n=5;n<=1000;n=n+5)
{
sum=sum+n;
}
printf("Sum is=%d\n",sum);
getch();
}
--------------------------------------------------------

144.sum 5+10+15+20+25----990+995+1000*** *** ***

#include
int main()
{
int n,sum;
for(n=5,sum=0;n<=1000;n=n+5)
{
sum=sum+n;
}
printf("Sum is=%d\n",sum);
getch();
}

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

145.print 5,10,15,20,25----990,995,1000*** *** ***

#include stdio.h
int main()
{
int n;
for(n=5;n<=1000;n=n+5)
{
printf("%d\n",n);
}
getch();
}

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

146.continue

#include stdio.h
int main()
{
int n=1;
for(n=1;n<=10;n=n+1)
{
printf("%d\n",n);
continue;
}
getch();
}

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

147.break

#include stdio.h
int main()
{
int n=1;
for(;n<=100;n=n+1)
{
printf("%d\n",n);
if(n>=50)
{
break;
}
}
getch();
}

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

148.>break

#include stdio.h
int main()
{
int n=1;
for(;n<=100;n=n+1)
{
printf("%d\n",n);
if(n>=50+1)
{
break;
}
}
getch();
}

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

149.break

#include stdio.h
int main()
{
int n=1;
for(;n<=100;n=n+1)
{
printf("%d\n",n);
break;
}
getch();
}

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

150.serial number for loop(1-100)*** *** ***

#include stdio.h
int main()
{
int n=1;
for(;n<=100;n=n+1)
{
printf("%d\n",n);
}
getch();
}

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

151.even number for loop(1-100)

#include stdio.h
int main()
{
int n=2;
for(;n<=100;n=n+2)
{
printf("%d\n",n);
}
getch();
}

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

152.even number for loop(1-100)

#include stdio.h
int main()
{
int n;
for(n=2;n<=100;)
{
printf("%d\n",n);
n=n+2;
}
getch();
}

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

153.even number for loop(1-100)

#include stdio.h
int main()
{
int n;
for(n=2;n<=100;n=n+2)
{
printf("%d\n",n);
}
getch();
}

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

154.for loop(1-100)

#include stdio.h
int main()
{
int n;
for(n=1;n<=100;n=n+1)
{
printf("%d\n",n);
}
getch();
}

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

155.even number while loop without if(1-100)

#include stdio.h
int main()
{
int n;
n=2;
while (n<=100)
{
printf("%d\n",n);
n=n+2;
}
getch();
}

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

156.even number while loop(1-100)

#include stdio.h
int main()
{
int n;
n=1;
while (n<=100)
{
if(n%2==0)
{
printf("%d\n",n);
}
n=n+1;
}
getch();
}

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

157.while loop(1-10)

#include stdio.h
int main()
{
int n;
n=1;
while (n<=10)
{
printf("%d\n",n);
n=n+1;
}
getch();
}

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

158.while loop(1-100)

#include stdio.h
int main()
{
int n;
n=1;
while (n<=100)
{
printf("%d\n",n);
n=n+1;
}
getch();
}

****159.print integer(1-10)***
#include stdio.h

int main()
{
int n;
n=1;
printf("%d\n",n);//1
n=n+1;
printf("%d\n",n);//2
n=n+1;
printf("%d\n",n);//3
n=n+1;
printf("%d\n",n);//4
n=n+1;
printf("%d\n",n);//5
n=n+1;
printf("%d\n",n);//6
n=n+1;
printf("%d\n",n);//7
n=n+1;
printf("%d\n",n);//8
n=n+1;
printf("%d\n",n);//9
n=n+1;
printf("%d\n",n);//10
getch();
}

****160.print integer(1-10)***
#include stdio.h
int main()
{
printf("1\n");
printf("2\n");
printf("3\n");
printf("4\n");
printf("5\n");
printf("6\n");
printf("7\n");
printf("8\n");
printf("9\n");
printf("10\n");
getch();
}

****161.Integer Test***
#include stdio.h
int main()
{
int n;
scanf("%d",&n);
if(n>=10-1)
{
printf("%d is greater than10\n",n);
}
else if(n>=5+1)
{
printf("%d is greater than5\n",n);
}
else{
printf("%d is less than 5\n",n);
}
getch();
}

****162.Inteter Test***
#include stdio.h
int main()
{
int n;
scanf("%d",&n);
if(n>=10+1)
{
printf("%d is greater than10\n",n);
}
else if(n>=5+1)
{
printf("%d is greater than5\n",n);
}
else{
printf("%d is less than 5\n",n);
}
getch();
}

****163.Result***
#include stdio.h
int main()
{
int marks;
char grade;
scanf("%d",&marks);
if(marks>=80)
{
grade='A+';
printf("Your grade is:%c\n",grade);
}
else if(marks>=70)
{
grade='A';
printf("Your grade is:%c\n",grade);
}
else if(marks>=60)
{
grade='A-';
printf("Your grade is:%c\n",grade);
}
else if(marks>=50)
{
grade='B';
printf("Your grade is:%c\n",grade);
}
else if(marks>=40)
{
grade='C';
printf("Your grade is:%c\n",grade);
}
else if(marks>=33)
{
grade='D';
printf("Your grade is:%c\n",grade);
}
else
{
printf("Your grade is:F\n");
}
getch();
}

****164.Condition integer***
#include stdio.h
int main()
{
int n;
scanf("%d",&n);
if(n>=10+1)
{
printf("%d is greater than10\n",n);
}
else if(n>=5+1)
{
printf("%d is greater than10\n",n);
}
getch();
}

****165.Convert ASCII value to character***
#include stdio.h
int main()
{
int n;
printf("Enter any ASCII value= ");
scanf("%d",&n);
printf("The ASCII character is=%c",n );
getch();
}

****166.Convert character to ASCII code***
#include stdio.h
int main() {
char ch;
printf("Enter any character= ");
scanf("%c",&ch);
printf("The ASCII value is= %d\n",ch);
getch();
}

****167.Patern-1(Nested loop)***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=row;col++){
printf("%d",col);
}
printf("\n");
}
getch();
}

****168.Patern-2***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=row;col++){
printf("%d",row);
}
printf("\n");
}
getch();
}

****169patern-3***
#include
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=row;col++){
printf("%d",col%2);
}
printf("\n");
}
getch();
}

****170patern-4***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=row;col++){
printf("%d",row%2);
}
printf("\n");
}
getch();
}

****171.patern-5***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=row;col++){
printf("%c",col+64);
}
printf("\n");
}
getch(); }

****172.patern-6***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=row;col++){
printf("%c",row+64);
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n-row;col++){
printf("%d ",col);
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n-row;col++){
printf("%c",row+64);
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n-row;col++){
printf("%d",row);
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n-row;col++){
printf("%d",col);
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n-row;col++){
printf("0",col);
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n-row;col++){
printf("%d",col);
}
printf("\n");
}
getch();
}

****Paralleogram***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n-row;col++){
printf(" ");
}
for(col=1;col<=n;col++){
printf("%d",row);
}
printf("\n");
}
getch();
}

****rightangle triangle***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n-row;col++){
printf(" ");
}
for(col=1;col<=row;col++){
printf("%d",row);
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n-row;col++){
printf(" ");
}
for(col=1;col<=row;col++){
printf("%d",col);
}
printf("\n");
}
getch();
}

****Piramid when n>10***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n-row;col++){
printf(" ");
}
for(col=10;col<=row;col++){
printf("%d",row);
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n-row;col++){
printf("%d",col);
}
printf("\n");
}
getch();
}

****Mix-up-Patern***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n-row;col++){
printf(" ");
}
for(col=1;col<=row;col++){
printf("%d",col); }
printf("\n");
}
for(row=n;row>=1;row--){
for(col=1;col<=n-row;col++){
printf(" ");
}
for(col=1;col<=row;col++){
printf("%d",col);
}
printf("\n");
}
getch();
}

****Mix-up-Patern***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n-row;col++){
printf(" ");
}
for(col=1;col<=row;col++){
printf("%d",col); }
printf("\n");
}
for(row=n-1;row>=1;row--){
for(col=1;col<=n-row;col++){
printf(" ");
}
for(col=1;col<=row;col++){
printf("%d",col);
}
printf("\n");
}
getch();
}

****printf***
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n-row;col++){
printf(" ");
}
for(col=1;col<=row;col++){
printf("%d",col); }
printf("\n");
}
for(row=n-1;row>=1;row--){
for(col=1;col<=n-row;col++){
printf(" ");
}
for(col=1;col<=row;col++){
printf("%d",row);
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n-row;col++){//space pring
printf(" ");
}
for(col=1;col<=row;col++){//number print
printf("%c",row+64);
}
printf("\n");
}
for(row=n-1;row>=1;row--){
for(col=1;col<=n-row;col++){
printf(" ");
}
for(col=1;col<=row;col++){
printf("%C",row+64);
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n-row;col++){//space pring
printf(" ");
}
for(col=1;col<=row;col++){//number print
printf("*",row);
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=n-1;row>=1;row--){
for(col=1;col<=n-row;col++){
printf(" ");
}
for(col=1;col<=row;col++){
printf("*",row);
}
printf("\n");
}
getch();
}

****printf***
#include
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n-row;col++){//space pring
printf(" ");
}
for(col=1;col<=row;col++){//number print
printf("*",row);
}
printf("\n");
}
for(row=n-1;row>=1;row--){
for(col=1;col<=n-row;col++){
printf(" ");
}
for(col=1;col<=row;col++){
printf("*",row);
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=n ;row>=1;row--){
for(col=1;col<=n-row;col++){
printf(" ");
}
for(col=1;col<=row;col++){
printf("%d",col);
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=n ;row>=1;row--){
for(col=1;col<=n-row;col++){
printf(" ");
}
for(col=1;col<=row;col++){
printf("%d",row);
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=n ;row>=1;row--){
for(col=1;col<=n-row;col++){
printf(" ");
}
for(col=1;col<=row;col++){
printf("%d",row%2);
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=n ;row>=1;row--){
for(col=1;col<=n-row;col++){
printf(" ");
}
for(col=1;col<=row;col++){
printf("%d",col%2);
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=n ;row>=1;row--){
for(col=1;col<=n-row;col++){
printf(" ");
}
for(col=1;col<=row;col++){
printf("%c",row+64);
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=n ;row>=1;row--){
for(col=1;col<=n-row;col++){
printf(" ");
}
for(col=1;col<=row;col++){
printf("%c",col+64);
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=n ;row>=1;row--){
for(col=1;col<=n-row;col++){
printf(" ");
}
for(col=1;col<=row;col++){
printf("#");
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n-row;col++){//space pring
printf(" ");
}
for(col=1;col<=row;col++){//number print
printf("%d",row%2);
}
printf("\n");
}
for(row=n-1;row>=1;row--){
for(col=1;col<=n-row;col++){
printf(" ");
}
for(col=1;col<=row;col++){
printf("%d",row%2);
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n-row;col++){//space pring
printf(" ");
}
for(col=1;col<=row;col++){//number print
printf("%d",col%2);
}
printf("\n");
}
for(row=n-1;row>=1;row--){
for(col=1;col<=n-row;col++){
printf(" ");
}
for(col=1;col<=row;col++){
printf("%d",col%2);
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n;col++){//space pring
printf("*");
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n;col++){//space pring
printf("%d",row);
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n;col++){//space pring
printf("%c",col+64);
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n;col++){//space pring
printf("%c",row+64);
}
printf("\n");
}
getch();
}

****row*column***
#include stdio.h
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=row;col++){
printf("%d ",row*col);
}
printf("\n");
}
getch();
}

****Triangle***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n-row;col++){//space pring
printf(" ");
}
for(col=1;col<=2*row-1;col++){//Star print
printf("*");
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n-row;col++){//space pring
printf(" ");
}
for(col=1;col<=2*row-1;col++){
printf("%d",col);
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n-row;col++){//space pring
printf(" ");
}
for(col=1;col<=2*row-1;col++){
printf("%d",row);
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n-row;col++){//space pring
printf(" ");
}
for(col=1;col<=2*row-1;col++){
printf("%c",col+64);
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col; printf("Enter N= "); scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n-row;col++){//space pring
printf(" ");
}
for(col=1;col<=2*row-1;col++){
printf("%c",row+64);
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=n;row>=1;row--){
for(col=1;col<=n-row;col++){//space pring
printf(" ");
}
for(col=1;col<=2*row-1;col++){//Star print
printf("%c",row+64);
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
#include stdio.h
int main()
{
int n, row, col; printf("Enter N= "); scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n-row;col++){//space pring
printf(" ");
}
for(col=1;col<=2*row-1;col++){
printf("%c",row+64);
}
printf("\n");
}
for(row=n-1;row>=1;row--){
for(col=1;col<=n-row;col++){//space pring
printf(" ");
}
for(col=1;col<=2*row-1;col++){//Star print
printf("%c",row+64);
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col; printf("Enter N= "); scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n-row;col++){//space pring
printf(" ");
}
for(col=1;col<=2*row-1;col++){
printf("%c",col+64);
}
printf("\n");
}
for(row=n-1;row>=1;row--){
for(col=1;col<=n-row;col++){//space pring
printf(" ");
}
for(col=1;col<=2*row-1;col++){//Star print
printf("%c",col+64);
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col; printf("Enter N= "); scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n-row;col++){//space pring
printf(" ");
}
for(col=1;col<=2*row-1;col++){
printf("*");
}
printf("\n");
}
for(row=n-1;row>=1;row--){
for(col=1;col<=n-row;col++){//space pring
printf(" ");
}
for(col=1;col<=2*row-1;col++){//Star print
printf("*");
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col; printf("Enter N= "); scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n-row;col++){//space pring
printf(" ");
}//end of space print
for(col=1;col<=row;col++){
printf("* ");
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col; printf("Enter N= "); scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n-row;col++){//space pring
printf(" ");
}//end of space print
for(col=1;col<=row;col++){
printf("*");
}
printf("\n");
}
getch();
}

****Rectangular***
#include stdio.h
int main()
{
int n, row, col; printf("Enter N= "); scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n;col++){//
if(row==1||row==n||col==1||col==n){
printf("*");
}else{
printf(" ");
}
}//end of space print
printf("\n");
}
getch();
}

****Rightangle Triangle***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n;col++){
if(col==1||row==n||row==col){
printf("*");
}else{
printf(" ");
}
}
printf("\n");
}
getch();
}

****X Star Patern***
#include stdio.h
int main()
{
int n, row, col;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n;col++){
if(row==col||row+col==n+1){
printf("*");
}else{
printf(" ");
}
}
printf("\n");
}
getch();
}

****Floyd's Triangle***
#include stdio.h
int main()
{
int n, row, col,count=0;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=row;col++){
printf("%d ",++count);
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col,count=0;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n-row;col++){
printf(" ");
}
for(col=1;col<=row;col++){
printf("%d",col);
}
for(col=row-1;col>=1;col--){
printf("%d",col);
}
printf("\n");
}
getch();
}

****printf***
#include stdio.h
int main()
{
int n, row, col,count=0;
printf("Enter N= ");
scanf("%d",&n);
for(row=1;row<=n;row++){
for(col=1;col<=n-row;col++){
printf(" ");
}
for(col=1;col<=row;col++){
printf("%d",col);
}
for(col=row-1;col>=1;col--){
printf("%d",col);
}
printf("\n");
}
for(row=n-1;row>=1;row--){
for(col=1;col<=n-row;col++){
printf(" ");
}
for(col=1;col<=row;col++){
printf("%d",col);
}
for(col=row-1;col>=1;col--){
printf("%d",col);
}
printf("\n");
}
getch();
}

****One dimentional array***
//declearation and initialization
#include stdio.h
int main(){
int num1, num2, num3, num4, num5;
num1=10;
num2=20;
num3=30;
num4=40;
num5=50;
int sum=num1+num2+num3+num4+num5;
printf("The sum is= %d\n",sum);
}

****printf***
//declearation and initialization
//datatype name[size];
// name[index]=data;
#include stdio.h
int main(){
int num[5];
num[0]=10;
num[1]=20;
num[2]=30;
num[3]=40;
num[4]=50;
printf("The second data is= %d\n",num[1]);
printf("The fouth data is= %d\n",num[3]);
}

****printf***
//declearation and initialization
//datatype name[size];
// name[index]=data;
#include stdio.h
int main(){
int num[5];
num[0]=10;
num[1]=20;
num[2]=30;
num[3]=40;
num[4]=50;
int sum=num[0]+num[1]+num[2]+num[3]+num[4];
printf("The sum is= %d\n",sum);
getch();
}

****printf***
//declearation and initialization
//datatype name[size]={data,data,data,... ...};
#include stdio.h
int main(){
int num[5]={10,20,30,40,50};
int sum=num[0]+num[1]+num[2]+num[3]+num[4];
printf("The sum is= %d\n",sum);
getch();
}

****printf***
//declearation and initialization
//datatype name[size]={data,data,data,... ...};
#include stdio.h
int main(){
int num[]={10,20,30,40,50};
printf("Fourth data is= %d\n",num[3]);
getch();
}

****printf***
//declearation and initialization
//datatype name[size]={data,data,data,... ...};
//without size
#include stdio.h
int main(){
int num[]={10,20,30,40,50};
int sum=num[0]+num[1]+num[2]+num[3]+num[4];
printf("The sum is= %d\n",sum);
getch();
}

****Loop in array***
//declearation and initialization
//datatype name[size]={data,data,data,... ...};
#include stdio.h
int main(){
int a[10],sum=0,i;
a[0]=10;
a[1]=20;
a[2]=30;
a[3]=40;
a[4]=50;
a[5]=60;
a[6]=70;
a[7]=80;
a[8]=90;
a[9]=100;
for(i=0;i<=10-1;i++){
sum=sum+a[i];
}
printf("The sum is= %d\n",sum);
getch();
}

****printf***
//declearation and initialization
//datatype name[size]={data,data,data,... ...};
#include stdio.h
int main(){
int a[10]={10,20,30,40,50,60,70,80,90,100};
int sum=0,i;
for(i=0;i<=10-1;i++){
sum=sum+a[i];
}
printf("The sum is= %d\n",sum);
getch();
}

****Sum and Average***
//declearation and initialization
//datatype name[size]={data,data,data,... ...};
#include stdio.h
int main(){
int a[10]={9,20,30,40,50,60,70,80,90,100};
int sum=0,i;
for(i=0;i<=10-1;i++){
sum=sum+a[i];
}
printf("The sum is= %d\n",sum);
printf("The average is= %.2f\n",(float)sum/10);
getch();
}

****Scan five numbers from users***
//declearation and initialization
//datatype name[size]={data,data,data,... ...};
#include
int main(){
int a[5];
int sum=0,i;
printf("Enter five numbers= ");
scanf("%d %d %d %d %d",&a[0],&a[1],&a[2],&a[3],&a[4]);
for(i=0;i<=5-1;i++){
sum=sum+a[i];
}
printf("The sum is= %d\n",sum);
printf("The average is= %.2f\n",(float)sum/5);
getch();
}

****printf***
#include stdio.h
int main(){
int sum=0,i;
int a[5];
printf("Enter five numbers= ");
for(i=0;i<=5-1;i++){
scanf("%d",&a[i]);
}
for(i=0;i<=5-1;i++){
sum=sum+a[i];
}
printf("The sum is= %d\n",sum);
printf("The average is= %.2f\n",(float)sum/5);
getch();
}

****printf***
#include stdio.h
int main(){
int sum=0,i,n;
int a[100];
printf("How many numbers you enter?= ");
scanf("%d",&n);
for(i=0;i<=n-1;i++){
scanf("%d",&a[i]);
}
for(i=0;i<=n-1;i++){
sum=sum+a[i];
}
printf("The sum is= %d\n",sum);
printf("The average is= %.2f\n",(float)sum/n);
getch();
}

****Identify maximum value***
//Display maximumm
#include stdio.h
int main(){
int sum=0,i,n;
int num[100];
printf("How many numbers you enter?= "); scanf("%d",&n);
for(i=0;i<=n-1;i++){
scanf("%d",&num[i]);
}
int max=num[0];
for(i=0;i<=n-1;i++){
if(max <=num[i]-1){
max=num[i];
}
}
printf("Maximum value is=%d\n",max);
getch();
}

****Identify Minimum value***
//Display minimum value
#include stdio.h
int main(){
int sum=0,i,n;
int num[100];
printf("How many numbers you enter?= ");
scanf("%d",&n);
for(i=0;i<=n-1;i++){
scanf("%d",&num[i]);
}
int min=num[0];
for(i=0;i<=n-1;i++){
if(min >= num[i]+1){
min=num[i];
}
}
printf("Minimum value is=%d\n",min);
getch();
}

****Array***
#include stdio.h
int main(){
int i;
int num[]={10,20,30,40,50};
for( i=0; i<=5-1; i++){
printf("%d ",num[i]);
}
getch();
}

****Array Pass in a function***
#include stdio.h
void display(int x[]){
int i;
for( i=0; i<=5-1; i++){
printf("%d ",x[i]);
}
}
int main(){
int num[]={10,20,30,40,50};
display(num);
getch();
}

****Find maximum value in Array***
#include stdio.h
int maximum(int x[]){
int i;
int max = x[0];
for( i=1; i<=6-1; i++){
if(max <= x[i]-1){
max = x[i];
}
}
return max;
}
int main(){
int num[]={10,20,30,40,50,-5};
int maximamValue = maximum(num);
printf("maximum= %d\n",maximamValue);
}

****Fibonakki series using array***
// Fibonakki Series #include stdio.h
int main(){
int a[100],n,i;
printf("Enter the number of items = ");
scanf("%d",&n);
a[0]=0;
a[1]=1;
for(i=2; i<=n-1; i++){
a[i] = a[i-1] + a[i-2];
}
printf("\n");
for(i=0;i<=n-1;i++){
printf("%d, ",a[i]);
}
getch();
}

****Linier searching number and position in arry***
#include stdio.h
int main(){
int num[]={10,2,30,15,28,5,19};
int value,pos=-1,i;
printf("Enter the value you want to search= ");
scanf("%d",&value);
for(i=0; i<=7-1; i++){
if(value==num[i]){
pos=i+1;
break;
}
}
if(pos==-1){
printf("Item is not found");
}else{
printf("The value is found at position index= %d\n",pos);
}
getch();
}

****Replace all items of an arry by another equal item's array***
#include stdio.h
int main(){
int array1[5]={1,2,3,4,5},array2[6]={6,7,8,9,10},i;
printf("Array2={6,7,8,9,10}\n");
printf("Array1's items are= ");
for(i=0; i<=5-1; i++){
printf("%d, ",array1[i]);
}
for(i=0; i<=5-1; i++){
array2[i]=array1[i];
}
printf("and Array2's items are= ");
for(i=0; i<=5-1; i++){
printf("%d, ",array2[i]);
}
getch();
}

****Two dimentional array***
//2D array
#include stdio.h
int main(){
int i,j;
int A[3][4]={{1,2,3,4},{5,6,7,8},{9,10,11,12}};
for(i=0;i<=3-1;i++){
for(j=0;j<=4-1;j++){
printf("%d ",A[i][j]);
}
printf("\n");
}
getch();
}

****Create a Matrix using 2D array***
//2D array
#include stdio.h
int main(){
int i,j;
int A[3][4];
for(i=0;i<=3-1;i++){
for(j=0;j<=4-1;j++){
printf("Enter elements for a matrix\n");
printf("A[%d][%d] =",i,j);
scanf("%d",&A[i][j]);
}
printf("\n ");
}
for(i=0;i<=3-1;i++){
for(j=0;j<=4-1;j++){
printf("%d ",A[i][j]);
}
printf("\n ");
}
getch();
}

****Create two matrix A and B using 2D array***
//2D array
#include stdio.h
int main(){
int i,j;
int A[3][4],B[3][4];
//scaning matrix A
printf("Enter elements of matrix A:\n");
for(i=0;i<=3-1;i++){
for(j=0;j<=4-1;j++){
printf("A[%d][%d] =",i,j);
scanf("%d",&A[i][j]);
}
printf("\n ");
}
//printing matrix A
printf("A=");
for(i=0;i<=3-1;i++){
printf("\t");
for(j=0;j<=4-1;j++){
printf("%d ",A[i][j]);
}
printf("\n ");
}
//scaning matrix B
printf("Enter elements of matrix B:\n");
for(i=0;i<=3-1;i++){
for(j=0;j<=4-1;j++){
printf("B[%d][%d] =",i,j);
scanf("%d",&B[i][j]);
}
printf("\n ");
}
//printing matrix B
printf("B=");
for(i=0;i<=3-1;i++){
printf("\t");
for(j=0;j<=4-1;j++){
printf("%d ",B[i][j]);
}
printf("\n ");
}
getch();
}

****Collect matrix size and elements from user***
//2D array
#include stdio.h
int main(){
int i,j,numberRows,numberCols;
int A[10][10],B[10][10],C[10][10];
printf("Enter the number of rows and columns: ");
scanf("%d %d",&numberRows,&numberCols);
//scaning matrix A
printf("Enter elements of matrix A:\n");
for(i=0;i<=numberRows-1;i++){
for(j=0;j<=numberCols-1;j++){
printf("A[%d][%d] =",i,j);
scanf("%d",&A[i][j]);
}
printf("\n ");
}
//printing matrix A
printf("A=");
for(i=0;i<=numberRows-1;i++){
printf("\t");
for(j=0;j<=numberCols-1;j++){
printf("%d ",A[i][j]);
}
printf("\n ");
}
//scaning matrix B
printf("Enter elements of matrix B:\n");
for(i=0;i<=numberRows-1;i++){
for(j=0;j<=numberCols-1;j++){
printf("B[%d][%d] =",i,j);
scanf("%d",&B[i][j]);
}
printf("\n ");
}
//printing matrix B
printf("B=");
for(i=0;i<=numberRows-1;i++){
printf("\t");
for(j=0;j<=numberCols-1;j++){
printf("%d ",B[i][j]);
}
printf("\n ");
}
getch();
}

****Collect size and all elements before print***
//2D array
#include stdio.h
int main(){
int i,j,numberRows,numberCols;
int A[10][10],B[10][10],C[10][10];
printf("Enter the number of rows and columns: ");
scanf("%d %d",&numberRows,&numberCols);
//scaning matrix A
printf("Enter elements of matrix A:\n");
for(i=0;i<=numberRows-1;i++){
for(j=0;j<=numberCols-1;j++){
printf("A[%d][%d] =",i,j);
scanf("%d",&A[i][j]);
} printf("\n ");
}
//scaning matrix B
printf("Enter elements of matrix B:\n");
for(i=0;i<=numberRows-1;i++){
for(j=0;j<=numberCols-1;j++){
printf("B[%d][%d] =",i,j);
scanf("%d",&B[i][j]);
}
printf("\n ");
}
//printing matrix A
printf("A=");
for(i=0;i<=numberRows-1;i++){
printf("\t");
for(j=0;j<=numberCols-1;j++){
printf("%d ",A[i][j]);
}
printf("\n ");
}
printf("\n ");
printf("\n ");
//printing matrix B
printf("B=");
for(i=0;i<=numberRows-1;i++){
printf("\t");
for(j=0;j<=numberCols-1;j++){
printf("%d ",B[i][j]);
}
printf("\n ");
}
getch();
}

****Adding two matrix C = A + B***
//2D array
#include stdio.h
int main(){
int i,j,numberRows,numberCols;
int A[10][10],B[10][10],C[10][10];
printf("Enter the number of rows and columns: ");
scanf("%d %d",&numberRows,&numberCols);
//scaning matrix A
printf("Enter elements of matrix A:\n");
for(i=0;i<=numberRows-1;i++){
for(j=0;j<=numberCols-1;j++){
printf("A[%d][%d] =",i,j);
scanf("%d",&A[i][j]);
}
printf("\n ");
}
//scaning matrix B
printf("Enter elements of matrix B:\n");
for(i=0;i<=numberRows-1;i++){
for(j=0;j<=numberCols-1;j++){
printf("B[%d][%d] =",i,j);
scanf("%d",&B[i][j]);
}
printf("\n ");
}
//printing matrix A
printf("A=");
for(i=0;i<=numberRows-1;i++){
printf("\t");
for(j=0;j<=numberCols-1;j++){
printf("%d ",A[i][j]);
}
printf("\n ");
}
printf("\n ");
printf("\n ");
//printing matrix B
printf("B=");
for(i=0;i<=numberRows-1;i++){
printf("\t");
for(j=0;j<=numberCols-1;j++){
printf("%d ",B[i][j]);
}
printf("\n ");
}
//Adding matrix C
for(i=0;i<=numberRows-1;i++){
for(j=0;j<=numberCols-1;j++){
C[i][j] = A[i][j] + B[i][j];
}
}
printf("\n ");
printf("\n ");
//printing matrix C
printf("C=A+B");
for(i=0;i<=numberRows-1;i++){
printf("\t");
for(j=0;j<=numberCols-1;j++){
printf("%d ",C[i][j]);
}
printf("\n ");
}
getch();
}

****Substraction between two matrix C = A - B***
//Subtruction of two matrix
#include stdio.h
int main(){
int i,j,numberRows,numberCols;
int A[10][10],B[10][10],C[10][10];
printf("Enter the number of rows and columns: ");
scanf("%d %d",&numberRows,&numberCols);
//scaning matrix A
printf("Enter elements of matrix A:\n");
for(i=0;i<=numberRows-1;i++){
for(j=0;j<=numberCols-1;j++){
printf("A[%d][%d] =",i,j);
scanf("%d",&A[i][j]);
}
printf("\n ");
}
//scaning matrix B
printf("Enter elements of matrix B:\n");
for(i=0;i<=numberRows-1;i++){
for(j=0;j<=numberCols-1;j++){
printf("B[%d][%d] =",i,j);
scanf("%d",&B[i][j]);
}
printf("\n ");
}
//printing matrix A
printf("A=");
for(i=0;i<=numberRows-1;i++){
printf("\t");
for(j=0;j<=numberCols-1;j++){
printf("%d ",A[i][j]);
}
printf("\n ");
}
printf("\n ");
printf("\n ");
//printing matrix B
printf("B=");
for(i=0;i<=numberRows-1;i++){
printf("\t");
for(j=0;j<=numberCols-1;j++){
printf("%d ",B[i][j]);
}
printf("\n ");
}
//Substracting matrix C for(i=0;i<=numberRows-1;i++){
for(j=0;j<=numberCols-1;j++){
C[i][j] = A[i][j] - B[i][j];
}
}
printf("\n ");
printf("\n ");
//printing matrix C
printf("C=A-B");
for(i=0;i<=numberRows-1;i++){
printf("\t");
for(j=0;j<=numberCols-1;j++){
printf("%d ",C[i][j]);
}
printf("\n ");
}
getch();
}

****Multiply between two matrix A(ixj)*B(jxk)=C(ixk)***
//multiplication of two matrix
#include stdio.h
int main(){
int r1,r2,c1,c2,i,j,k,sum=0;
int first[10][10],second[10][10],multiplied[10][10];
printf("Enter row and column of first matrix: ");
scanf("%d %d",&r1,&c1);
printf("Enter row and column of second matrix: ");
scanf("%d %d",&r2,&c2);
while(c1 != r2){
printf("Error! must be c1=r2!");
printf("\n");
printf("Enter row and column of first matrix: ");
scanf("%d %d",&r1,&c1);
printf("Enter row and column of second matrix: ");
scanf("%d %d",&r2,&c2);
printf("OK Fine!\n");
}
printf("\n ");
printf("\n ");
//scaning first matrix
printf("Enter elements of first matrix:\n");
for(i=0;i<=r1-1;i++){
for(j=0;j<=c1-1;j++){ printf("first[%d][%d] =",i,j);
scanf("%d",&first[i][j]);
}
printf("\n ");
}
printf("\n ");
printf("\n ");
//scaning second matrix
printf("Enter elements of second matrix:\n");
for(i=0;i<=r2-1;i++){
for(j=0;j<=c2-1;j++){
printf("second[%d][%d] =",i,j);
scanf("%d",&second[i][j]);
}
printf("\n ");
}
printf("\n ");
printf("\n ");
//multiplay metrix
for(i=0;i<=r1-1;i++){
for(j=0;j<=c2-1;j++){
for(k=0;k<=c1-1;k++){
sum=sum+first[i][k]*second[k][j];
}
multiplied[i][j]=sum;
sum=0;
}
}
printf("\n ");
printf("\n ");
//printing first matrix
printf("First=");
printf("\n ");
for(i=0;i<=r1-1;i++){
printf("\t");
for(j=0;j<=c1-1;j++){
printf("%d ",first[i][j]);
}
printf("\n ");
}
printf("\n ");
printf("\n ");
//printing second matrix
printf("Second=");
printf("\n ");
for(i=0;i<=r2-1;i++){ printf("\t");
for(j=0;j<=c2-1;j++){
printf("%d ",second[i][j]);
}
printf("\n ");
}
printf("\n ");
printf("\n ");
//print multiplied matrix
printf("\n ");
printf("Multiplied =");
printf("\n ");
for(i=0;i<=r1-1;i++){
printf("\t");
for(j=0;j<=c2-1;j++){
printf("%d ",multiplied[i][j]);
}
printf("\n ");
}
getch();
}

****Transpose matrix***
//multiplication of two matrix
#include
int main(){
int i,j,row,col;
int A[10][10],transposeA[10][10];
printf("Enter the number of rows and columns: ");
scanf("%d %d",&row,&col);
//scaning matrix A
printf("Enter elements of matrix A:\n");
for(i=0;i<=row-1;i++){
for(j=0;j<=col-1;j++){
printf("A[%d][%d] =",i,j);
scanf("%d",&A[i][j]);
} printf("\n ");
}
//printing matrix A
printf("A=");
for(i=0;i<=row-1;i++){
printf("\t");
for(j=0;j<=col-1;j++){
printf("%d ",A[i][j]);
}
printf("\n ");
}
for(i=0;i for(j=0;j transposeA[j][i]=A[i][j];
}
}
printf("\n ");
printf("\n ");
printf("\n ");
//printing matrix transposeA
printf("At=");
for(i=0;i<=col-1;i++){
printf("\t");
for(j=0;j<=row-1;j++){
printf("%d ",transposeA[i][j]);
}
printf("\n ");
}
getch();
}

****Sum of diagonal elements of a matrix***
//Sum of first diagonal of A
#include stdio.h
int main(){
int i,j,row,col,sum=0;
int A[10][10],diagonalSumA;
printf("Enter the number of rows and columns: ");
scanf("%d %d",&row,&col);
//scaning matrix A
printf("Enter elements of matrix A:\n");
for(i=0;i<=row-1;i++){
for(j=0;j<=col-1;j++){
printf("A[%d][%d] =",i,j);
scanf("%d",&A[i][j]);
} printf("\n ");
}
//printing matrix A
printf("A=");
for(i=0;i<=row-1;i++){
printf("\t");
for(j=0;j<=col-1;j++){
printf("%d ",A[i][j]);
}
printf("\n ");
}
//sum of diagonal
printf("Diagonal elements are= ");
for(i=0;i<=row-1;i++){
for(j=0;j<=col-1;j++){
if(i==j){
printf("%d ",A[i][j]);
sum=sum+A[i][j];
}
}
}
printf("\n ");
printf("\n ");
printf("\n ");
//printing diagonalSumA
printf("diagonalSumA= %d",sum);
getch();
}

****Sum elements of upper triangles of matrix***
#include stdio.h
int main(){
int i,j,row,col,upperSum=0;
int A[10][10];
printf("Enter the number of rows and columns: ");
scanf("%d %d",&row,&col);
//scaning matrix A
printf("Enter elements of matrix A:\n");
for(i=0;i<=row-1;i++){
for(j=0;j<=col-1;j++){
printf("A[%d][%d] =",i,j);
scanf("%d",&A[i][j]);
} printf("\n ");
}
//printing matrix A
printf("A=");
for(i=0;i<=row-1;i++){ printf("\t"); for(j=0;j<=col-1;j++){
printf("%d ",A[i][j]);
}
printf("\n ");
}
//sum of diagonal
printf("Elements of upperSum are= ");
for(i=0;i<=row-1;i++){
for(j=0;j<=col-1;j++){
if(i<=j-1){
printf("%d ",A[i][j]);
upperSum=upperSum+A[i][j];
}
}
}
printf("\n ");
printf("Sum elements of upper triangle is= %d",upperSum);
printf("\n ");
//printing diagonalSumA
getch();
}

****Sum elements of lower triangles of matrix***
#include stdio.h
int main(){
int i,j,row,col,lowerSum=0;
int A[10][10];
printf("Enter the number of rows and columns: ");
scanf("%d %d",&row,&col);
//scaning matrix A
printf("Enter elements of matrix A:\n");
for(i=0;i<=row-1;i++){
for(j=0;j<=col-1;j++){
printf("A[%d][%d] =",i,j);
scanf("%d",&A[i][j]);
} printf("\n ");
}
//printing matrix A
printf("A=");
for(i=0;i<=row-1;i++){
printf("\t");
for(j=0;j<=col-1;j++){
printf("%d ",A[i][j]);
}
printf("\n ");
}
//sum of diagonal
printf("Elements of lowerSum are= ");
for(i=0;i<=row-1;i++){
for(j=0;j<=col-1;j++){
if(i>=j+1){
printf("%d ",A[i][j]);
lowerSum=lowerSum+A[i][j];
}
}
}
printf("\n ");
printf("Sum elements of low triangle is= %d",lowerSum);
printf("\n ");
//printing diagonalSumA
getch();
}

****Sum elements of upper and lower triangles of matrix***
#include stdio.h
int main(){
int i,j,row,col,lowerSum=0,upperSum=0;
int A[10][10];
printf("Enter the number of rows and columns: ");
scanf("%d %d",&row,&col);
//scaning matrix A
printf("Enter elements of matrix A:\n");
for(i=0;i<=row-1;i++){
for(j=0;j<=col-1;j++){
printf("A[%d][%d] =",i,j);
scanf("%d",&A[i][j]);
} printf("\n ");
}
//printing matrix A
printf("A=");
for(i=0;i<=row-1;i++){
printf("\t");
for(j=0;j<=col-1;j++){
printf("%d ",A[i][j]);
}
printf("\n ");
}
printf("\n ");
printf("\n ");
printf("\n ");
printf("Elements of upperSum are= ");
for(i=0;i<=row-1;i++){
for(j=0;j<=col-1;j++){
if(i<=j-1){
printf("%d ",A[i][j]);
upperSum=upperSum+A[i][j];
}
}
}
printf("\n ");
printf("Sum elements of upper triangle is= %d",upperSum);
printf("\n ");
printf("\n ");
printf("\n ");
printf("\n ");
//Elements of lower triangle
printf("Elements of lowerSum are= ");
for(i=0;i<=row-1;i++){
for(j=0;j<=col-1;j++){
if(i>=j+1){
printf("%d ",A[i][j]);
lowerSum=lowerSum+A[i][j];
}
}
}
printf("\n ");
printf("Sum elements of low triangle is= %d",lowerSum);
printf("\n ");
//printing diagonalSumA
getch();
}

****Conditional Programs***
#include stdio.h
int main()
{
int A,B;
printf("Enter the value of A= ");
scanf("%d",&A);
printf("Enter the value of B= ");
scanf("%d",&B);
if(A>B)
printf("A is greater than B");
else if(B>A)
printf("B is greater than A");
else
printf("A and B are equal");
getch();
}

****Check Leap Year***
#include stdio.h
int main()
{
int year;
printf("Enter a year to check\n= ");
scanf("%d",&year);
if(year%400==0)
printf("%d is a leap year.\n",year);
else if(year%100==0)
printf("%d is a leap year.\n",year);
else if(year%4==0)
printf("%d is a leap year.\n",year);
else
printf("%d is not a leap year.\n",year);
getch();
}

****Check number is Even or Odd***
#include stdio.h
int main()
{
int n;
printf("Enter a Number\n= ");
scanf("%d",&n);
if(n%2==0)
printf("%d is Even.\n",n);
else
printf("%d is Odd.\n",n);
getch();
}

****Check the character is vowel or not***
#include stdio.h
int main()
{
char c;
printf("Enter an alphabet\n= ");
scanf("%c",&c);
if(c=='a'||c=='A'||c=='e'||c=='E'||c=='i'||c=='I'||c=='o'||c=='O'||c=='u'||c=='U')
printf("This is a Vowel.\n");
else
printf("This is not Vowel.\n");
getch();
}

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

****Heading***

1 টি মন্তব্য:

Bottom

Beauty

Enter your email and send message!

email updates

Message form

নাম

ইমেল *

বার্তা *

Bottom

Facebook

সহকারী শিক্ষক

সহকারী শিক্ষক
মুঃ আবদুল করিম
বি,এস-সি, বি,এড,(গণিত)

সহকারী শিক্ষক

সহকারী শিক্ষক
মিঃ হেদায়েত উল্ল্যাহ বি,এ,বি,এড, এম,এ(ইংরেজী)

সহকারী শিক্ষক

সহকারী শিক্ষক
মিঃ রনজিত রয়(কম্পিউটার)

সহকারী শিক্ষক

সহকারী শিক্ষক
মিঃ তিলক বড়ুয়া
বি,কম,বি,পি,এড,

সহকারী শিক্ষক

সহকারী শিক্ষক
মিসেস সালমা

সহকারী শিক্ষক

সহকারী শিক্ষক
মিসেস কামরুন নাহার
বি,এস-সি,বি,এড,এম,এড,(জীব বিজ্ঞান)

সহকারী শিক্ষক

সহকারী শিক্ষক
মুহাঃ হারুনুর রশীদ
এম,এম,এম,টি,এম,এ,এম,এড

সহকারী শিক্ষক

সহকারী শিক্ষক
মিসেস রোকেয়া তাসনীম
বি,এ ,বি,এড,(সমাজ)

সহকারী শিক্ষক

সহকারী শিক্ষক
এ,টি,এম আব্দুল মমিন
এম,কম,বি,এড,(হিসাব বিজ্ঞান)

Clock

Firozshah School

Header ads

Header ads

প্রবেশ পথ

প্রবেশ পথ