Acquire C Programming
রবিবার, ৩ মে, ২০১৫
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
এতে সদস্যতা:
পোস্টগুলি (Atom)