//C Program to print "Hello World".
#include <stdio.h>
int main(void) {
printf("Hello World");
return 0;
}
by @bca_programmer//C Program for print age
#include <stdio.h>
int main() {
int age = 22;
printf("age is %d", age);
return 0;
}π1
// C Program to Take Age as Input from the user
#include <stdio.h>
int main(){
int age;
printf("Enter Age : ");
scanf("%d", &age);
printf("age is : %d", age);
return 0;
}π1
C program for sum of two integer a,b.
#include <stdio.h>
int main()
{
// Declare variables to store the two integers
int a, b;
// Read the two integers from the user
printf("Enter a : ");
scanf("%d", &a);
printf("Enter b : ");
scanf("%d", &b);
// Calculate the sum of the two integers
int sum = a + b;
// Print the sum to the user
printf("The sum is : %d", sum);
return 0;
}C program for Calculate Area of square .
#include <stdio.h>
int main() {
int side;
printf("Enter side : ");
scanf("%d", &side);
//"ar" is Area of square
int ar= (side*side);
printf("Area is : %d", ar);
return 0;
}C program for Calculate Area of Circle .
#include <stdio.h>
int main() {
int radius;
printf("Enter radius : ");
scanf("%d", &radius);
int ar= (3.14*radius*radius);
printf("Area is : %d", ar);
return 0;
}Guys wait for two days I will post programs
I'm little busy actually β€οΈ
I'm little busy actually β€οΈ
π4β€1π₯1
//Question for all
#include <stdio.h>
int main() {
printf("%d", 10*3/10*3);
return 0;
}
//What will be the output ?
#include <stdio.h>
int main() {
printf("%d", 10*3/10*3);
return 0;
}
//What will be the output ?
//Type Declaration Instructions
#include<stdio.h>
int main() {
int age = 22;
int oldAge = age;
int newAge = oldAge + 2;
printf("new age is : %d", newAge);
int rupee = 1, dollar;
dollar = 74;
/*
order of declaration is important - Wrong Declaration Order
float pi = 3.14;
float area = pi * rad * rad;
float rad = 3;
*/
// valid declaration
int age1, age2, age3;
age1 = age2 = age3 = 22;
//invalid
//int a1 = a2 = a3 = 22;
return 0;
}//write code in C langugae if a number is greater than 9 & less than 100-> True (2 digit num).
#include<stdio.h>
int main()
{
int num;
//input the number
printf("Enter the number: ");
scanf("%d", &num);
//check if the number is in the given range
if(num > 9 && num < 100)
{
printf("True");
}
else
{
printf("False");
}
return 0;
}//To find adult or minor age
#include <stdio.h>
int main(void) {
int age;
printf("Enter age : ");
scanf("%d", &age);
if (age > 18)
{
printf("adult");
}
else
{
printf("Minor");
return 0;
}
}//To find adult or minor age
#include <stdio.h>
int main(void) {
int age;
printf("Enter age : ");
scanf("%d", &age);
if (age > 18)
{
printf("adult\n");
printf("They can vote \n");
printf("They can drive car \n");
}
else
{
printf("Minor\n");
printf("They can't vote \n");
printf("They can't drive car\n");
}
return 0;
}
\\To find adult, Teenager , or child
#include <stdio.h>@bca_programmer
int main(void) {
int age;
printf("Enter age : ");
scanf("%d", &age);
if (age >= 18)
{
printf("adult\n");
printf("They can vote \n");
printf("They can drive car \n");
}
else if(age > 13 && age < 18){
printf("Teenager\n");
printf("They can't drive\n");
printf("They can't vote\n");
}
else {
printf("Child\n");
printf("They can't vote \n");
printf("They can't drive car\n");
}
printf("Thank You");
return 0;
}
π1
#include <stdio.h>
int main()
{
int age;
printf("Enter Age : ");
scanf("%d", &age);
//by ternary operator
// syntax condition ? doSomething if TRUE : doSomething if FALSE;
age >= 18 ? printf("adult\n") : printf("not adult");
return 0;
}//Switch case
#include <stdio.h>
int main()
{
int day;
printf("Enter day(1-7) : ");
scanf("%d", &day);
switch (day){
case 1 : printf("Monday\n");
break;
case 2 : printf("Tuesday\n");
break;
case 3 : printf("Wednesday\n");
break;
case 4 : printf("Thursday\n");
break;
case 5 : printf("Friday\n");
break;
case 6 : printf("Saturday\n");
break;
case 7 : printf("Sunday\n");
break;
default : printf("Not a valid day");
}
return 0;
}