Saturday, August 16, 2014

BCA LECTURE-2 C PROGRAMMING

Input in C
scanf() function used for input in c programming language.
int x;
scanf(“%d”,&x);
float y;
scanf(“%f”,&y);
int x,y;
scanf(“%d%d”,&x,&y);
or
scanf(“%d”,&x);
scanf(“%d”,&y);

float x,y;
scanf(“%f%f”,&x,&y);
char d;
scanf(“%c”,&d);


scanf(“%d%d”,&a,&b);
r=a+b;

t=a+b+c+d;

si=p*n*r/100;

scanf(“%f”,&r);
a=3.14*r*r;

t=s1+s2+s3+s4+s5;


Arithmetic operator
+    -    *    /    % (remainder)

int a=6,b=2,r;
r=a/b;
r= 3;

int a=6,b=2,r;
r=a%b;
r= 0;

e.g1
int a=5,b=2;
r1=a/b;       r2=a%b;
r1=2;                            r2=1;



Take marks of Five subject & find total marks & percentage
t=s1+s2+s3+s4+s5;
p=t/5;

find square & cube of input number.
s=n*n;
c=n*n*n;

1   1.  Write C Program to Display Message:- Welcome to C
 2. Write C Program to Display Message:-
              C is Procedural Programming Language.
              Major Operating System Written in C.
              C Developed by Dennis Richie.
 3. Write C Program to take any number & find square & cube of that number.
4. Write C Program to take marks of Five Subjects & find total marks and percentage.
5. Write C Program to find area of circle.  a=3.14*r*r
6. Write C Program to find area of rectangle. a=l*b
7. Write C Program to take any two numbers & swap them using third variable. t=a; a=b; b=t;
8. Write C Program to take any two numbers & swap them without using third variable. a=a+b; b=a-b; a=a-b;


No comments:

Post a Comment

JAC Board Computer || IIT 2025 || Introductory Information Technology || Class 10 || Practical Examination 2025

Marks Division HOE 30 Marks IT Application Report File 20 Marks Viva - Voce 10 Marks 1) Write an HTML code to generate a web p...