C Language1
C Language1
C Language1
#include <stdio.h>
int main() {
int radius;
int area;
float pi = 13.4;
printf("Enter radius");
scanf("%d", &radius);
area = pi*radius*radius;
return 0;
//Area of a square
#include <stdio.h>
int main() {
int side;
int area;
scanf("%d", &side);
area = side*side;
printf("%d", area);
return 0;
}
//Perimeter of rectangle
Int Prectangle;
Int length;
Int width;
Printf(
int main() {
int prectangle;
int length;
int width;
printf("Enter length");
scanf("%d", &length);
printf("Enter width");
scanf("%d", &width);
//take a number from user & output its cube(n*n*n) (not executing, doesn’t give any output)
#include <stdio.h>
int main() {
int number;
printf("Enter a number");
scanf("%d", &number);
number = number*number*number;
return 0
};
//a program to print average of 3 numbers
#include <stdio.h>
int main() {
int number1;
int number2;
int number3;
int avg;
return 0;
#include <stdio.h>
int main() {
char key;
scanf("%c", &key);
if (key=='a' || key=='A')
printf("Pass");
else
printf("fail");
return 0;
}
//individual number should not be negative
int main(){
int a;
int b;
int c;
int d;
scanf("%d", &a);
scanf("%d", &b);
scanf("%d", &c);
scanf("%d", &d);
else
printf("\nWrong input");
return 0;
//Atm
int main() {
// atm
int amount;
int notes2000, notes500, notes200, notes100;
scanf("%d", &amount);
notes2000 = amount/2000;
amount -= notes2000*2000;
notes500 = amount/500;
amount-= notes500*500;
notes200 = amount/200;
amount -= notes200*200;
notes100 = amount/100;
amount -= notes100*100;
return 0;
#include <stdio.h>
int main()
int Maths;
int Science;
int Hindi;
int percentage;
scanf("%d", &Maths);
scanf("%d", &Science);
scanf("%d", &Hindi);
percentage = (Maths+Science+Hindi)/300*100;
if (percentage<33)
printf("Fail");
printf("3rd division");
printf("2nd division");
else
printf("1st division");
return 0;
#include <stdio.h>
int main(){
int year;
printf("Enter year");
scanf("%d",&year);
else
{
printf("It's not a leap year");
return 0;
#include <stdio.h>
int main(){
int marks;
scanf("%d", &marks);
switch (marks)
break;
break;
break;
break;
break;
return 0;
#include <stdio.h>
int main(){
int day;
switch(day)
break;
break;
break;
break;
break;
break;
break;
return 0;
#include <stdio.h>
int main () {
int sub1;
int sub2;
int total;
int percentage;
scanf("%d", &sub1);
scanf("%d", &sub2);
total = sub1+sub2;
percentage=total/200;
if (percentage>=60)
printf("First division");
else if (percentage>=45)
printf("Second division");
else if (percentage>=33)
printf("Third division");
else
printf("Fail");
return 0;
#include <stdio.h>
int main()
int num;
scanf("%d", &num);
switch (num)
break;
return 0;
#include <stdio.h>
int main()
int num;
scanf("%d", &num);
switch (num%2==0)
break;
break;
return 0;
#include <stdio.h>
//Design a program that calculates the final price of a product after applying a discount. Use
the ternary operator to calculate the discount based on the original price.
int main() {
int price;
int discount;
int original_price;
scanf("%d", &price);
scanf("%d", &discount);
original_price = price*100/100-discount;
printf("%d", original_price);
return 0;