Bangladesh National University Result

Custom Search

Wednesday, October 21, 2009

Primary C programming

//Find out Average with unlimited variable

// programed by Syed Razwanul Haque Nabil

//SUST,Physics
//+08801915548801 +08801717973140
//nabilscience@yahoo.com nabilphysics.blogspot.com
In all programme there stdio.h library function
#include stdio.h
main()
{

in t n, count = 1;
float x, average, sum= 0;
printf("How many numbers");
scanf("%d", &n);
do {
printf("x= ");
scanf("%f",&x);
sum += x;
++count;
}
while (count <= n);

average = sum/n;
printf("\nThe average is %f\n", average);
}


//2
// Simple Programme to calculate area and circuference
// Physics 18th Batch CSE C programme lab 22/11/2009
//nabilphysics.blogspot.com ID:200713203 01915548801;01717973140

#include stdio.h //#include
main()
{
do

{
float r,c,A;
printf("Please enter the value of Radius= ");



scanf("%f",&r);
c=2*3.1416*r;
A=3.1416*r*r;

printf("Now the result is circumference= ");

printf("%.3f",c);
printf(" \nArea is= ");
printf("%f",A);
}
while(1);
}



//Digit creator 3

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


//4
//Physics 18th Batch CSE C programme class

#include
main()
{
int i;
printf("Please enter the value of i= ");
scanf("%i",&i);
printf("%d\n",i++);
printf("%d",i);
}

//5

//Physics 18th Batch CSE C programme class nabilphysics.blogspot.com
//01915548801 01717973140 Syed Razwanul Haque Nabil 2007132023

#include stdio.h //#include
main()

{

float a,b,c;
printf("Please enter the value of A= and then press enter"); //coment

scanf("%f",&a);
printf("Please enter the value of B and then press enter");
scanf("%f",&b);
c=a+b;
printf("The result is = ");
printf("%f",c);
printf("\nThank you Stay well");
}

//6
// Physics 18th Batch CSE C programme lab 22/11/2009
//nabilphysics.blogspot.com ID:200713203 01915548801;01717973140

#include stdio.h
#include math.h
main()
{
int a,b,c;
float x1,x2;
printf("Enter value of a,b,c: ");
scanf("%d%d%d",&a,&b,&c);
if
(b*b-4*a*c>0)
{
x1=(-b+sqrt(b*b-4*a*c))/(2*a);
x2=(-b-sqrt(b*b-4*a*c))/(2*a);

printf("%f\n %f",x1,x2);
}

else
printf("Wrong Choice of Numbers");
}

//7
//Physics 18th Batch CSE C lab 22/10/2009
// nabilphysics.blogspot.com 01915548801 01717973140 Syed Razwanul Haque Nabil


#include stdio.h
main()
{
do
{
int marks;
printf("\nEnter your marks:= ");
scanf("%d",&marks);

if(marks>=80)
{
printf("A+");
printf("\n Congrates \n");
}
else
if(marks>=70)
{
printf("A");
printf("\n Good \n");
}
else
if(marks>=60)
{
printf("A-");
printf("\n Average \n");
}
else
if(marks>=50)
{
printf("B+");
printf("\n Try to upgrade \n");
}
else
if(marks>=40)
{
printf("B-");
printf("\n Not so good \n");
}
else
if(marks>=33)
{
printf("C");
printf("\n Oh no Be careful \n");
}
else
if(marks<32)
{
printf("Failed");
printf("\n Oh Sorry ");
}
}
while(1);
}


                                    //8// Physics 18th Batch C Programme LAB class 28/10/2009  

#include stdio.h
main()
{
int p;
printf("Please enter the value P: ");
scanf("%d",&p);

        if(p>2)
            if(p<25)
                printf("Number is between 2 and 25");
        else
          printf("Number is not in range 2 to 25");
        }







                                    //9// Physics 18th Batch C Programme LAB class 28/10/2009 


#include stdio.h  //programme will give output as much number you entered
main()
{
do
{
int p;
printf("\nEnter the value of show printf: ");
scanf("%d",&p);
    while(p>0)

    {
      printf(" \n nabilphysics.blogspot.com \n");
      p--;    //for decrasing value
    }
}
 while(1);
}

 

No comments:

Post a Comment

Search Anything you want.just write and click search and see the magic