BCA Programmer
194 subscribers
20 photos
8 videos
26 files
21 links
Download Telegram
//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 ❀️
πŸ‘4❀1πŸ”₯1
Program to accept a number from user and print it’s square & cube.

#include<stdio.h>
#include<conio.h>

void main()
{
int n,sqre,cube;
clrscr();

printf("Enter Number: ");
scanf("%d",&n);

sqre=n*n;
cube=n*n*n;

printf("\nSquare: %d\nCube: %d",sqre,cube);

getch();
}
//Question for all

#include <stdio.h>

int main() {

printf("%d", 10*3/10*3);
return 0;
}



//What will be the output ?
Do u want any programming course?
❀1πŸ”₯1
//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>
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;
}

@bca_programmer
πŸ‘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;
}
//Switch case (char var)


#include <stdio.h>
int main()
{
char day; //m-Monday , t-Tuesday ,,,,etc.
printf("Enter day(m-s) : ");
scanf("%s", &day);
switch (day){
case 'm' : printf("Monday\n");
break;
case 't' : printf("Tuesday\n");
break;
case 'w' : printf("Wednesday\n");
break;
case 'o' : printf("Thursday\n");
break;
case 'f' : printf("Friday\n");
break;
case 's' : printf("Saturday\n");
break;
case 'p' : printf("Sunday\n");
break;
default : printf("Not a valid day");
}
return 0;
}
// Program to check if a student fail or pass


#include <stdio.h>
int main()
{
int marks;
printf("Enter marks (0-100): ");
scanf("%d", &marks);

if (marks>=0 && marks <=30){
printf("Fail\n");
}
else if(marks >30 && marks<=100) {
printf("Pass");

}
else {

printf("Invalid marks");
}
return 0;
}
//Program to check fail or pass using ternary operator

#include <stdio.h>
int main()
{
int marks;
printf("Enter marks (0-100): ");
scanf("%d", &marks);

(marks <= 30 )? printf("Fail\n") : printf("Pass\n");
return 0;
}
// marks < 33is C
// 33<=marks < 70 is B
// 70 <= marks <90 is A
// 90 <= marks <= 100 is A+


#include <stdio.h>
int main()
{
int marks;
printf("Enter marks (0-100): ");
scanf("%d", &marks);

if (marks<33 ){
printf("Grade C\n");
}
else if(marks>=33 && marks<70) {
printf("Grade B");
}
else if(marks >=70 && marks <90) {

printf("Grade A");
}
else {
printf("Grade A+\n");
printf("Topper");
}

return 0;
}
// to find Uppercase and Lowercase character

#include <stdio.h>
int main()
{
char ch;
printf("Enter character : ");
scanf("%c", &ch);
if (ch >='A' && ch <='Z' )
{
printf("Uppercase\n");
}
else if (ch >= 'a' && ch <='z' ) {
printf("Lowercase\n");
}
else {
printf("Not an English letter");
}
return 0;
}