If 4 digits number is input through the keyboard, Write a
program to calculate sum of its 1st & 4th digit.
Answer Posted / jagannatha reddy
#include<stdio.h>
#include<conio.h>
void main()
{
int i,r,n,m=0;
clrscr();
printf("enter any 4 digit number");
scanf("%d",&n);
r=n%10;
for(i=1;i<=3;i++)
{
n=n/10;
}
printf("the sum is %d",(r+m));
}
| Is This Answer Correct ? | 5 Yes | 5 No |
Post New Answer View All Answers
Why does everyone say not to use scanf? What should I use instead?
How can you check to see whether a symbol is defined?
typedef enum { html, java, javascript, perl, cgi } lang;The above statement defines a : a) Union b) User defined type c) Enumerated variable d) none
What is the use of c language in real life?
Where we use clrscr in c?
Write a code of a general series where the next element is the sum of last k terms.
Why isnt any of this standardized in c?
What are register variables? What are the advantage of using register variables?
What are Macros? What are its advantages and disadvantages?
What is typedef struct in c?
Can we access the array using a pointer in c language?
stripos — Find position of first occurrence of a case- insensitive string int stripos ( char* haystack, char* needle, int offset ) Returns the numeric position of the first occurrence of needle in the haystack string. Note that the needle may be a string of one or more characters. If needle is not found, stripos() will return -1. The function should not make use of any C library function calls.
A variable that is defined in a specified portion of a program but can be used throughout the program a) global variable b) local variable c) character d) none
What does sizeof return c?
If I have a char * variable pointing to the name of a function ..