Follow

# Lowborn is album number seven! Did you ever imagine you would record and release so many albums?

View Full Interview Answered

# Write a program to find sum of two numbers in c language without using variables?

include"stdio.h" int main ( int argc, char *argv[ ] ) { if(argc == 2) printf("Sum of Two Numbers: %d \\r\\n", atoi( argv[1] ) + atoi( argv[2] ) ); else printf( "In-valid n…umber of arguments !! \\r\\n" );return 0; }Regards,Lakshmi Sreekanth (MORE)

Answered

In Technology

# C program to find sum of two sparse matrices?

#include <stdio.h> #include <stdlib.h> typedef struct node { int column; int value; … int row; struct node *next; } element; /* MENU */ void Menu() { printf("\\n***\\tADDING SPARSE MATRICES\\t***\\n"); printf("\\n 1.) Insert in A"); printf("\\n 2.) Insert in B"); printf("\\n 3.) Printout both"); printf("\\n 4.) A + B = "); printf("\\n 0.) EXIT"); printf("\\nChoose ---------> "); } /* Initialize*/ void Init (element *x[]) { int i; for (i=0; i<3; i++) x[i] = NULL; } /* Printout */ void Printout (element *x[]) { int i, test = 0; element *temp; for (i=0; i<3; i++) { temp = x[i]; while (temp != NULL) { printf("Element position (%d,%d) = %d\\n", i, temp->column, temp->value); test = 1; temp = temp->next; } } if (test 0) printf("This matrix is empty!!\\n"); } /* INSERT */ void Insert(element *x[], int row, int column, int value) { int r = row; element *p; element *new = malloc(sizeof(element)); new->row = row; new->column = column; new->value = value; if (x[r] NULL) { x[r] = new; new->next = NULL; } else { p = x[r]; if (new->column < p->column) { new->next = p; x[r] = new; } else if (new->column > p->column) { while (p->next != NULL && p->next->column < new->column) { p = p->next; } new->next = p->next; p->next = new; } else printf("An element already exists there!!\\n"); } } /* A + B */ void Add (element *x[],element *y[],element *z[]) { int i; element *p, *q; for (i=0; i<3; i++) { /*row of x empty, row of y not*/ if (x[i] NULL && y[i] != NULL) { q = y[i]; while (q != NULL) { Insert(z, i, q->column, q->value); q = q->next; } } /*row of y empty, row of x not*/ if (x[i] != NULL && y[i] NULL) { q = x[i]; while (q != NULL) { Insert(z, i, q->column, q->value); q = q->next; } } /*row of x and y not empty*/ if (x[i] != NULL && y[i] != NULL) { p = x[i]; q = y[i]; /*stay in while loop until one row runs out*/ while (p != NULL || q != NULL) { /*columns match*/ if (p->column == q->column && p != NULL && q != NULL) { Insert(z, i, p->column , p->value + q->value); p = p->next; q = q->next; } /*column of x is smaller than column of y*/ else if (p->column < q->column) { Insert(z, i, p->column , p->value); p = p->next; } /*column of x is bigger than column of y*/ else { Insert(z, i, q->column , q->value); q = q->next; } } /*if row of x had more elements and didn't run out*/ if (p != NULL) { while (p != NULL) { Insert(z, i, p->column , p->value); p = p->next; } } /*if row of x had more elements and didn't run out*/ if (q != NULL) { while (q != NULL) { Insert(z, i, q->column , q->value); q = q->next; } } } } Printout(z); } /* FREE MEMORY*/ void Freedom (element *x[]) { int i; element *p; for (i=0; i<3; i++) { if (x[i] != NULL) { p = x[i]; x[i] = x[i]->next; free(p); } } } /* MAIN */ int main (int argc, const char * argv[]) { int choice, column, row, value, number; element *a[3], *b[3], *sum[3]; Init(a); Init(b); Init(sum); do { Menu(); scanf("%d",&choice); switch (choice) { case 1: /*Insert in A */ do { printf("Enter row -> "); scanf("%d",&row); } while (row < 0 || row > 3); do { printf("Enter column -> "); scanf("%d",&column); } while (column < 0); printf("Enter value -> "); scanf("%d",&value); Insert(a,row,column,value); break; case 2: /*Insert in B */ do { printf("Enter row -> "); scanf("%d",&row); } while (row < 0 || row > 2); do { printf("Enter column -> "); scanf("%d",&column); } while (column < 0); printf("Enter value -> "); scanf("%d",&value); Insert(b,row,column,value); break; case 3: /* Printout A & B */ printf("\\n::::::: MATRIX A :> \\n\\n"); Printout(a); printf("\\n::::::: MATRIX B :> \\n\\n"); Printout(b); break; case 4: /* A + B */ Init(sum); printf("\\n::::::: MATRIX A + B :> \\n\\n"); Add(a,b,sum); break; default: printf("\\nWRONG CHOICE"); } } while (choice != 0); Freedom(a); Freedom(b); Freedom(sum); return 0;} (MORE)

Answered

# How do you find the sum in c language?

include<stdio.h> #include<conio.h> void main() { clrscr(); int a,b,sum; printf("Enter two nos."); scanf("%d%d",&a,&b); sum=a+b; printf("Sum is = %…d",sum); getch(); } (MORE)

# Free and Easy Online Spreadsheet Programs

There are a number of reasons you might need to create a spreadsheet, be it for business or for pleasure. Many office programs are quite expensive, so it pays to have a low-co…st or even free alternative. There are several online spreadsheet programs that offer free options for this essential (MORE)

# Free Graphics Programs Online

The tools used in graphic design can be a costly investment, particularly if the user is not working as a professional in the field of digital arts. There are many individuals… who like to edit photos, create home art pieces, do crafts with their children, and other projects that require (MORE)

In Skin Care

# User Reviews for the Clean Program

One of the newest diet crazes is the Clean Program created by Dr. Alejandro Junger. This restorative detox diet lasts 21 days and consists of two meals of "Clean" shakes, one …meal of solid foods and plenty of water in between. In order for you to make up your mind (MORE)

Answered

In Technology

# C program to find sum of digits of a number using function?

#include<stdio.h> #include<conio.h> void main() { int sumdig(int); int n,sum,d,f,rev=0; clrscr(); printf("enter the number"); scanf("%d",&n); sum=sumd…ig(n); printf("%d",sum); getch(); } int sumdig(int n) { int sum,d,r=0; if(n==0) return(0); else sum=n%10+sumdig(n/10); while(sum!=0) { d=sum%10; r=r+d; sum=sum/10; } return(r); } (MORE)

Answered

In Technology

# A program to find sum of digits repeatedly until a single digit is obtained?

include<stdio.h> #include<conio.h> main() { int n,s=0,sum=0,i,d; printf("enter the number"); scanf("%d",&n); while(n>0) { d=n%10; s=s+d; n=n/10; … } while(s>0) { i=s%10; sum=sum+i; s=s/10; } printf("%d",sum); getch(); } (MORE)

Answered

# C program to find the sum of the digits of a number?

Here You go........... # include<stdio.h># include<conio.h>void main(){int no,sum=0,rem=0;clrscr();printf("\\nEnter a Number: ");scanf("%d",&no);while(no>0)…{rem=no%10;sum=sum+rem;no=no/10;}printf("\\nSum of digits of a number: %d",sum);getch();} (MORE)