0% found this document useful (0 votes)
48 views14 pages

Anand C Program

The document contains multiple C programming code snippets demonstrating basic operations such as addition, subtraction, multiplication, and division, along with input and output functionalities. It also includes programs for calculating the area of a square and a circle, as well as finding the total and average of numbers. The examples cover both integer and floating-point operations, showcasing various ways to handle user input and display results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views14 pages

Anand C Program

The document contains multiple C programming code snippets demonstrating basic operations such as addition, subtraction, multiplication, and division, along with input and output functionalities. It also includes programs for calculating the area of a square and a circle, as well as finding the total and average of numbers. The examples cover both integer and floating-point operations, showcasing various ways to handle user input and display results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd

C Pogramming language

1. #include <stdio.h>

int main() {

// Write C code here

printf("Hello world");

return 0;

2. #include <stdio.h>

int main() {

int a=45, b=65, c;

c=a+b;

printf("%d",c);

return 0;

}
3. #include <stdio.h>

int main() {

int a=95, b=63, c;

c=a-b;

printf("%d",c);

return 0;

4. #include <stdio.h>

int main() {

int a=90, b=66, c;

c=a*b;

printf("%d",c);

return 0;

5. #include <stdio.h>

int main() {
int a=90, b=30, c;

c=a/b;

printf("%d",c);

return 0;

6. #include <stdio.h>

int main() {

int a, b;

printf("Enter a");

scanf("%d",&a);

printf("Enter b");

scanf("%d",&b);

int c=a+b;

printf("c is :%d",c);

return 0;

}
7. #include <stdio.h>

int main() {

int a, b;

printf("enter a");

scanf("%d",&a);

printf("enter b"),

scanf("%d",&b);

int c=a-b;

printf("c is :%d",c);

return 0;

8. #include <stdio.h>
int main() {

int a, b;

printf("a");

scanf("%d",&a);

printf("b");

scanf("%d",&b);

int c=a*b;

printf("c%d",c);

return 0;

9. #include <stdio.h>

int main() {

int a, b;

printf("a");

scanf("%d",&a);

printf("b");

scanf("%d",&b);

int c=a/b;

printf("c%d",c);
return 0;

10. #include <stdio.h>

float main() {

float a, b;

printf("a");

scanf("%f",&a);

printf("b");

scanf("%f",&b);

float c=a/b;

printf("c%f",c);

return 0;

11. #include <stdio.h>


float main() {

float a, b;

printf("a");

scanf("%f",&a);

printf("b");

scanf("%f",&b);

float c=a=b;

printf("c%f",c);

return 0;

12. #include <stdio.h>

float main() {

float a=56.3, b=96.3, c;

c=a+b;

printf("%.2f\n",c);

return 0;

}
// writen a program to caculate area of squarre

13. #include<stdio.h>

int main(){

int side;

printf("enter side");

scanf("%d",&side);

printf("side is:%d",side*side);

return 0;

14. // writen a program to caculate of circle (radi

us)

//area of square

float main(){

float radius;
printf("enter radius");

scanf("%f",&radius);

printf("area is:%f",3.14*radius *radius);

return 0;

[Link] two number used (i)


#include <stdio.h>

int main() {

int a, b ;

printf("enter a");

scanf("%i",&a);

printf("enter b");

scanf("%i",&b);

int c=a+b;

printf("c is :%i",c);

return 0;

}
[Link] first latter input;
#include <stdio.h>

void main ()

char ch;

printf("enter a character");

ch=getchar();

putchar(ch);

return 0;

}
[Link] a program 2number,find the sum.
#include <stdio.h>

int main() {
int a,b,sum;
printf("enter 2 number:");
scanf("%d%d",&a,&b);
sum=a+b;
printf("Sum=%d",sum);

return 0;
}

output
enter 2 number:23 12
Sum=35
[Link] a program to reead marks in 3subjects ,find the total and
average marks.
#include <stdio.h>

int main() {
int a,b,c,total;
float Avg;
printf("Enter marks of three number");
scanf("%d%d%d",&a,&b,&c);
total=a+b+c;
Avg=total/3;
printf("%d\n",total);
printf("Average is:%f",Avg);
return 0;
}

output
Enter marks of three number78 45 12
135
Average is:45.000000

19./*A player has a played three matches and score1,score2,and


score3 in these match write a program to find the average run score
by player*/
#include<stdio.h>
int main() {
int score1,score2,score3, total_run;
float Average_score;
printf("Enter run score by player:");
scanf("%d%d%d",&score1,&score2,&score3);
total_run=score1+score2+score3;
Average_score =total_run/3;
printf("Total=%d\n",total_run);
printf("Average =%.2f",Average_score);

return 0;
}

output
Enter run score by player:78 96 99

Total=273

Average =91.00

You might also like