Posts

Showing posts from October, 2023

C++ Programming

 1. write a program in C++ to accept two number and find there sum and average using input function.     #include <iostream>     int main () {         double num1, num2;                 // Accept two numbers from the user         std::cout << "Enter the first number: " ;         std::cin >> num1;                 std::cout << "Enter the second number: " ;         std::cin >> num2;                 // Calculate the sum         double sum = num1 + num2;                 // Calculate the average         double average = sum / 2 ;                 // Display the results         std::cout ...

C Programming

 C Programming  1. Write a program in C to print any name and give to a welcome message.  Ans:         #include <stdio.h>         int main () {             char name [ 100 ];             printf ( "Please enter your name: " );             scanf ( " %s " , name );             printf ( "Welcome, %s ! This is C programming. \n " , name );             return 0 ;         } 2. Write a program in C to accept two number and find there sum, subtract, multiple and divided. Ans:         #include <stdio.h>         int main () {             float num1 , num2 ;             float sum , subtract , multiple , division ;             // A...