রবিবার, ৩ মে, ২০১৫
Pyramid in C Language
লেবেলসমূহ:
C Programming
Fibonacci Series with C Programming
// Fibonacci Series in C Programming
#include<stdio.h>
int main(){
int n,i, a = 0, b = 1, fib;
printf("Enter the number of terms:");
scanf("%d",&n);
printf("First %d Number of Fibonacci series are :\t",n);
for ( i = 0 ; i < n ; i++ ){
if ( i <= 1 )
fib = i;
else{
fib = a + b;
a = b;
b = fib;
}
printf("%d\t",fib);
}
return 0;
}
Output
#include<stdio.h>
int main(){
int n,i, a = 0, b = 1, fib;
printf("Enter the number of terms:");
scanf("%d",&n);
printf("First %d Number of Fibonacci series are :\t",n);
for ( i = 0 ; i < n ; i++ ){
if ( i <= 1 )
fib = i;
else{
fib = a + b;
a = b;
b = fib;
}
printf("%d\t",fib);
}
return 0;
}
Output
লেবেলসমূহ:
C Programming
বৃহস্পতিবার, ৩০ এপ্রিল, ২০১৫
Print Prime Number
লেবেলসমূহ:
C Programming
Leap Year count in C Programming
//Leap Year count in C Programming
#include <stdio.h>
int main()
{
int year;
printf("Enter a year to check if it is a leap year:");
scanf("%d", &year);
if ( year%400 == 0)
printf("%d is a leap year.", year);
else if ( year%100 == 0)
printf("%d is not a leap year.", year);
else if ( year%4 == 0 )
printf("%d is a leap year.", year);
else
printf("%d is not a leap year.", year);
return 0;
}
Result :
#include <stdio.h>
int main()
{
int year;
printf("Enter a year to check if it is a leap year:");
scanf("%d", &year);
if ( year%400 == 0)
printf("%d is a leap year.", year);
else if ( year%100 == 0)
printf("%d is not a leap year.", year);
else if ( year%4 == 0 )
printf("%d is a leap year.", year);
else
printf("%d is not a leap year.", year);
return 0;
}
Result :
লেবেলসমূহ:
C Programming
রবিবার, ২৬ এপ্রিল, ২০১৫
A simple Calculator with C Programming
// Developed By Muhammad Rakib Hasan
// A simple Calculator with C Programming
#include<stdio.h>
int add(int num1,int num2);
float division(int num1,int num2);
int multiplication(int num1,int num2);
int substruction(int num1,int num2);
int main()
{
int a,b,output,subs;
float div,multi;
char ch;
printf("Please Enter +,-,* or / :");
scanf("%c",&ch);
if(ch=='+'){
printf("Please Enter First Number:");
scanf("%d",&a);
printf("Please Enter Second Number:");
scanf("%d",&b);
output=add(a,b);
printf("The sum of %d and %d is : %d\n",a,b,output);
}
else if(ch=='-'){
printf("Please Enter First Number:");
scanf("%d",&a);
printf("Please Enter Second Number:");
scanf("%d",&b);
subs=substruction(a,b);
printf("The substruction Value of %d and %d is: %d",a,b,subs);
}
else if(ch=='*'){
printf("Please Enter First Number:");
scanf("%d",&a);
printf("Please Enter Second Number:");
scanf("%d",&b);
multi=multiplication(a,b);
printf("The Multiplication Value of %d and %d is : %f",a,b,multi);
}
else if(ch=='/'){
printf("Please Enter First Number:");
scanf("%d",&a);
printf("Please Enter Second Number:");
scanf("%d",&b);
div=division(a,b);
printf("The Division Value of %d and %d is: %f",a,b,div);
}
else{
printf("Invalid input");
}
return 0;
}
int add(int a,int b){
int sum;
sum=a+b;
return sum;
}
int substruction(int a,int b){
int subs;
subs=a-b;
return subs;
}
int multiplication(int a,int b){
int multi;
multi=a*b;
return multi;
}
float division(int a,int b){
float div;
div=(float)a/b;
return div;
}
Result :
// A simple Calculator with C Programming
#include<stdio.h>
int add(int num1,int num2);
float division(int num1,int num2);
int multiplication(int num1,int num2);
int substruction(int num1,int num2);
int main()
{
int a,b,output,subs;
float div,multi;
char ch;
printf("Please Enter +,-,* or / :");
scanf("%c",&ch);
if(ch=='+'){
printf("Please Enter First Number:");
scanf("%d",&a);
printf("Please Enter Second Number:");
scanf("%d",&b);
output=add(a,b);
printf("The sum of %d and %d is : %d\n",a,b,output);
}
else if(ch=='-'){
printf("Please Enter First Number:");
scanf("%d",&a);
printf("Please Enter Second Number:");
scanf("%d",&b);
subs=substruction(a,b);
printf("The substruction Value of %d and %d is: %d",a,b,subs);
}
else if(ch=='*'){
printf("Please Enter First Number:");
scanf("%d",&a);
printf("Please Enter Second Number:");
scanf("%d",&b);
multi=multiplication(a,b);
printf("The Multiplication Value of %d and %d is : %f",a,b,multi);
}
else if(ch=='/'){
printf("Please Enter First Number:");
scanf("%d",&a);
printf("Please Enter Second Number:");
scanf("%d",&b);
div=division(a,b);
printf("The Division Value of %d and %d is: %f",a,b,div);
}
else{
printf("Invalid input");
}
return 0;
}
int add(int a,int b){
int sum;
sum=a+b;
return sum;
}
int substruction(int a,int b){
int subs;
subs=a-b;
return subs;
}
int multiplication(int a,int b){
int multi;
multi=a*b;
return multi;
}
float division(int a,int b){
float div;
div=(float)a/b;
return div;
}
Result :
লেবেলসমূহ:
C Programming
শুক্রবার, ২৪ এপ্রিল, ২০১৫
Finding Factorial in C program
লেবেলসমূহ:
C Programming
Simple calculator using switch...case statement in C programming.
// Simple calculator using switch...case statement in C programming.
# include <stdio.h>
int main()
{
char o;
float a,b;
printf("Enter operator either + or - or * or divide : ");
scanf("%c",&o);
printf("Enter First Value: ");
scanf("%f",&a);
printf("Enter Second Value: ");
scanf("%f",&b);
switch(o) {
case '+':
printf("%.1f + %.1f = %.1f",a, b, a+b);
break;
case '-':
printf("%.1f - %.1f = %.1f",a, b, a-b);
break;
case '*':
printf("%.1f * %.1f = %.1f",a, b, a*b);
break;
case '/':
printf("%.1f / %.1f = %.1f",a, b, a/b);
break;
default:
printf("Error! operator is not correct");
break;
}
return 0;
}
Output :
# include <stdio.h>
int main()
{
char o;
float a,b;
printf("Enter operator either + or - or * or divide : ");
scanf("%c",&o);
printf("Enter First Value: ");
scanf("%f",&a);
printf("Enter Second Value: ");
scanf("%f",&b);
switch(o) {
case '+':
printf("%.1f + %.1f = %.1f",a, b, a+b);
break;
case '-':
printf("%.1f - %.1f = %.1f",a, b, a-b);
break;
case '*':
printf("%.1f * %.1f = %.1f",a, b, a*b);
break;
case '/':
printf("%.1f / %.1f = %.1f",a, b, a/b);
break;
default:
printf("Error! operator is not correct");
break;
}
return 0;
}
Output :
লেবেলসমূহ:
C Programming
Finding Prime numbers with c programming
//Finding Prime numbers
#include<stdio.h>
int main(){
int n, i = 3, count, c;
printf("Enter the number of prime numbers required:");
scanf("%d",&n);
if ( n >= 1 ) {
printf("First %d prime numbers are :\n",n);
}
for ( count = 2 ; count <= n ; ){
for ( c = 2 ; c <= i - 1 ; c++ ){
if ( i%c == 0 )
break;
}
if ( c == i ){
printf("%d,",i);
count++;
}
i++;
}
return 0;
}
Result :
লেবেলসমূহ:
C Programming
Find LCM of two positive integers with c Programming
//Find LCM of two positive integers with c Programming
#include <stdio.h>
int main()
{
int i, j, k;
printf("Enter First positive integers: ");
scanf("%d", &i);
printf("Enter First positive integers: ");
scanf("%d", &j);
k=(i>j) ? i : j;
while(1)
{
if(k%i==0 && k%j==0)
{
printf("LCM of %d and %d is : %d", i, j,k);
break;
}
++k;
}
return 0;
}
Result :
#include <stdio.h>
int main()
{
int i, j, k;
printf("Enter First positive integers: ");
scanf("%d", &i);
printf("Enter First positive integers: ");
scanf("%d", &j);
k=(i>j) ? i : j;
while(1)
{
if(k%i==0 && k%j==0)
{
printf("LCM of %d and %d is : %d", i, j,k);
break;
}
++k;
}
return 0;
}
Result :
লেবেলসমূহ:
C Programming
Find Highest Common Factor with C Program .
//greatest common divisor
//Highest Common Factor
// Find Highest Common Factor with C Program .
#include<stdio.h>
int main(){
int i,j,k,gcd;
printf("Please Enter First Number:");
scanf("%d",&j);
printf("Please Enter Second Number:");
scanf("%d",&k);
for(i=1;i<=j||i<=k;++i){
if(j%i==0&&k%i==0){
gcd=i;
}
}
printf("\nThe greatest common divisor of %d and %d is : %d\n",j,k,gcd);
return 0;
}
Result :
//Highest Common Factor
// Find Highest Common Factor with C Program .
#include<stdio.h>
int main(){
int i,j,k,gcd;
printf("Please Enter First Number:");
scanf("%d",&j);
printf("Please Enter Second Number:");
scanf("%d",&k);
for(i=1;i<=j||i<=k;++i){
if(j%i==0&&k%i==0){
gcd=i;
}
}
printf("\nThe greatest common divisor of %d and %d is : %d\n",j,k,gcd);
return 0;
}
Result :
লেবেলসমূহ:
C Programming
বুধবার, ২২ এপ্রিল, ২০১৫
Ascending Number Print with C Programming
লেবেলসমূহ:
C Programming
Descending Decimal Number
লেবেলসমূহ:
C Programming
Print Descending Star using C Programming.
লেবেলসমূহ:
C Programming
সোমবার, ২০ এপ্রিল, ২০১৫
Star print
লেবেলসমূহ:
C Programming
Addition value of Even numbers in given range
//Developed By Muhammad Rakib Hasan 2279
//Addition value of Even numbers in given range
#include<stdio.h>
int main(){
int s,e,sum=0;
printf("Enter a starting value: ");
scanf("%d",&s);
printf("Enter a ending value: ");
scanf("%d",&e);
printf("Addition value of Even numbers in given range are: \n\n");
for(s;s<e;s++){
if(s%2==0){
sum=sum+s;
}
}
printf("%d",sum);
return 0;
}
Result :
//Addition value of Even numbers in given range
#include<stdio.h>
int main(){
int s,e,sum=0;
printf("Enter a starting value: ");
scanf("%d",&s);
printf("Enter a ending value: ");
scanf("%d",&e);
printf("Addition value of Even numbers in given range are: \n\n");
for(s;s<e;s++){
if(s%2==0){
sum=sum+s;
}
}
printf("%d",sum);
return 0;
}
Result :
লেবেলসমূহ:
C Programming
Lower And Upper Case
//Developed By Muhammad Rakib Hasan 2279
//Lower And Upper Case
#include<stdio.h>
int main(){
char a;
printf("Please Enter a Case :");
scanf("%c",&a);
if(a>='A'&& a<='Z'){
printf("%c is Upper case. ",a);
}
else if(a>='a'&& a<='z'){
printf("%c is Lower case. ",a);
}
else{
printf("Please Enter a Valid input ! ");
}
return 0;
}
//Lower And Upper Case
#include<stdio.h>
int main(){
char a;
printf("Please Enter a Case :");
scanf("%c",&a);
if(a>='A'&& a<='Z'){
printf("%c is Upper case. ",a);
}
else if(a>='a'&& a<='z'){
printf("%c is Lower case. ",a);
}
else{
printf("Please Enter a Valid input ! ");
}
return 0;
}
Result :
লেবেলসমূহ:
C Programming
Mark Sheet Using C Language
//Developed By Muhammad Rakib Hasan 2279
//Mark sheet
#include<stdio.h>
int main(){
int marks;
printf("Enter A Valied Marks: ");
scanf("%d",&marks);
if(marks>=80&&marks<=100){
printf("Your Grade Point Is A+");
}
else if(marks>=70&&marks<=79){
printf("Your Grade Point Is A");
}
else if(marks>=60&&marks<=69){
printf("Your Grade Point Is A-");
}
else if(marks>=50&&marks<=59){
printf("Your Grade Point Is B");
}
else if(marks>=40&&marks<=49){
printf("Your Grade Point Is C");
}
else if(marks>100){
printf("Please Enter Between 0-100, Valid Marks");
}
else{
printf("Your Grade is F");
}
}
Result:
//Mark sheet
#include<stdio.h>
int main(){
int marks;
printf("Enter A Valied Marks: ");
scanf("%d",&marks);
if(marks>=80&&marks<=100){
printf("Your Grade Point Is A+");
}
else if(marks>=70&&marks<=79){
printf("Your Grade Point Is A");
}
else if(marks>=60&&marks<=69){
printf("Your Grade Point Is A-");
}
else if(marks>=50&&marks<=59){
printf("Your Grade Point Is B");
}
else if(marks>=40&&marks<=49){
printf("Your Grade Point Is C");
}
else if(marks>100){
printf("Please Enter Between 0-100, Valid Marks");
}
else{
printf("Your Grade is F");
}
}
Result:
লেবেলসমূহ:
C Programming
রবিবার, ১৯ এপ্রিল, ২০১৫
Odd and Even Number identify using and operator
লেবেলসমূহ:
C Programming
শুক্রবার, ১৭ এপ্রিল, ২০১৫
Age Calculation using if else if statement
Please write down a code where you can input your "age" if your age is between (0 to14) then show "You are a child" if your age is between (15 to 35) then show "You are a young" if your age is between then (36 to 50) then show "You are a middle aged" if your age is greater then 50 then show "You are a old".
Assalamolalikum dear Mentor and friends,
Now i want to share you a concept on this problem in C Programming ..
01.Firstly i have to need one variable declaration (int age;).
02.After variable declaration ,i need the code by which can i input a starting and a ending value (printf("Please Enter you Age : ");
scanf("%d", &age);)
03.Then it is necessary to me the logic implementation "(if(age>=0 && age<=14){
printf("You are a child");
}")
one by one this logic are applied .......
04.Finally show the output result ..
Here the code and Screenshot
Solution of Above problem :
//Developed By Muhammad Rakib Hasan
// Age Calculation using if else if
#include <stdio.h>
int main(){
int age;
printf("Please Enter you Age : ");
scanf("%d", &age);
if(age>=0 && age<=14){
printf("You are a child");
}
else if(age>=15 && age<=35){
printf("You are a young");
}
else if(age>=36 && age<=50){
printf("You are a middle aged");
}
else{
printf("You are old");
}
return 0;
}
Result:
লেবেলসমূহ:
C Programming
এতে সদস্যতা:
পোস্টগুলি (Atom)



