Find the Average of Two numbers using Command Line Language
C Programming Language / Command Line Arguments
705Program:
#include int main(int argc, char * argv[]) { int sum = 0,i = 1,count = 0; if(argc == 1) { printf("Enter the number \n"); exit(1); } count = argc - 1; while (i <= count ) { sum += atoi (argv[i]) ; i++; } printf("Avg of the numbers.%d\n", sum/count); }
Output:
10 12 Avg of the numbers.11
Explanation:
Nope
This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.
# C Tutorials
# JAVA Tutorials
# HTML Tutorials
# Computer Fundamental
# Data Structure
# DBMS Tutorials
SQL
# C# Language
# R Language
# PHP
# Python
# Vue JS